Lagrange proved that all positive integers can be expressed as the sum of four squares. For example, 27 = 16 + 9 + 1 + 1. However, it can also be expressed as the sum of three squares (9 + 9 + 9). In contrast, while 47 = 36 + 9 + 1 + 1, it cannot be expressed as a sum of fewer than four squares.
Write a function that produces the nth member of the sequence of numbers that cannot be expressed as the sum of fewer than four non-zero squares.
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers4
Suggested Problems
-
2342 Solvers
-
3839 Solvers
-
Calculate the Hamming distance between two strings
342 Solvers
-
Replace all zeros and NaNs in a matrix with the string 'error'
103 Solvers
-
222 Solvers
More from this Author321
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!