A263765 Minimum number of squares necessary to write n as a sum or difference of squares.
1, 1, 2, 2, 1, 2, 3, 2, 2, 1, 2, 2, 2, 2, 3, 2, 1, 2, 2, 2, 2, 2, 3, 2, 2, 1, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 1, 2, 3, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 1, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 2, 1, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2
Offset: 0
Keywords
Examples
a(6) = 3 because 6 = 2^2 + 1^2 + 1^2 and 6 is not the sum or the difference of two squares; a(28) = 2 because 28 = 8^2 - 6^2.
Links
- Jean-Christophe Hervé, Table of n, a(n) for n = 0..10000
Formula
Using the partition of the natural numbers into A000290 (square numbers), A000415 (sum of 2 nonzero squares), A263737 (difference but not sum of 2 squares) and A062316 (neither the sum or difference of 2 squares), the sequence is completely defined by: a(A000290(n)) = 1, a(A000415(n)) = a(A263737(n)) = 2, a(A062316(n)) = 3.
Comments