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.
- All Contests
- ProjectEuler+
- Project Euler #152: Writing 1/2 as a sum of inverse squares
Project Euler #152: Writing 1/2 as a sum of inverse squares
Project Euler #152: Writing 1/2 as a sum of inverse squares
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