We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #152: Writing 1/2 as a sum of inverse squares

Project Euler #152: Writing 1/2 as a sum of inverse squares

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 152 from projecteuler.net

There are several ways to write the number as a sum of inverse squares using integers.

For instance, the numbers can be used:

In fact, only using integers between and inclusive, there are exactly three ways to do it, the remaining two being: and .

How many ways are there to write the number as a sum of inverse squares using distinct integers between and inclusive?

Input Format

Each test file contains two lines. One the first line there is an integer , on the second line there is an integer .

Constraints

  • is a product of digits of some natural number.
  • The answer is always

Output Format

Output a single number the answer to the problem.

Sample Input

2
45

Sample Output

3

Author

bayleef

Difficulty

Advanced

Max Score

100

Submitted By

188

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy