# Need help with this hard question/riddle?

Find all natural numbers n<20202020 such that for any positive integer m the sum n^m + 1 is representable as the sum of the squares of two integers.

The answer is the sum of these numbers.

### 1 Answer

- husoskiLv 72 months agoFavorite Answer
If allowed to guess, and allowed to do so more than once, I'd start with a guess that the answer is all square numbers. If n == a^2 for some integer a, then n^m + 1 = (a^2)^m + 1 = (a^m)^2 + 1 is trivially the sum of two squares.

I've verified that the only values of n under 40 that work are squares, so this is closer to a conjecture than a pure guess.

If that's the case, there's a well-known formula for the sum of the first K squares:

1 + 4 + 9 + 16 + ... + k^2 + ... + K^2 = K(K+1)(2K+1) / 6

You can set K to the largest integer less than or equal to sqrt(20202020) and finish the guess.