This is a math problem I came across the other day: $365$ can be written as a sum of two and also three consecutive perfect squares: $365=14^2+13^2=12^2+11^2+10^2$ What is the next number with this property? Give the last 4 digits of the number. The perfect squares cannot be zero. I would like to know what would be a good way (esp. performance-wise) to check all first, lets say, 1000000, natural numbers if they can be represented in the way above, using *Mathematica*?