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.

Loading...

- All Contests
- ProjectEuler+
- Project Euler #171: Finding numbers for which the sum of the squares of the digits is a square

# Project Euler #171: Finding numbers for which the sum of the squares of the digits is a square

# Project Euler #171: Finding numbers for which the sum of the squares of the digits is a square

_{This problem is a programming version of Problem 171 from projecteuler.net}

For a positive integer , let be the sum of the squares of the digits (in base ) of , e.g.

,

,

Find the sum of all , , such that is a perfect square modulo .

**Input Format**

The first line of input contains the only integer .

**Constraints**

**Output Format**

Output the only integer which is the answer for the problem.

**Sample Input 0**

```
100
```

**Sample Output 0**

```
826
```

**Explanation 0**

You have to sum up following numbers: .