login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A263765 Minimum number of squares necessary to write n as a sum or difference of squares. 1
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
This sequence is equivalent to A002828 (least number of squares that add up to n) for sums and differences of squares. Here the possible forms include not only sums of squares, but also differences like x^2 - y^2 or x^2 + y^2 - z^2.
a(n) <= A002828(n) which is <= 4 (Lagrange's "Four Squares theorem"). In fact, a(n) <= 3: numbers of the form 4k, 4k+1 or 4k+3 are equal to the difference of two squares, therefore a(n) <= 2 in this case, and a(4k+2) <= 3 because 4k+2 = 4k+1+1^2. More precisely, a(4k) = 1 or 2; a(4k+1) = 1 or 2; a(4k+2) = 2 or 3; a(4k+3) = 2.
If A002828(n) = 4, a(n) = 2 (see A004215); if A002828(n) = 3, a(n) = 2 or 3: this shows that the form x^2 + y^2 - z^2 is never necessary to write an integer with the minimum number of squares; and of course, if A002828 = 1 or 2, a(n) = A002828.
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.
EXAMPLE
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.
CROSSREFS
Sequence in context: A309287 A056173 A216817 * A335424 A270073 A027348
KEYWORD
nonn
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 25 13:12 EST 2024. Contains 370330 sequences. (Running on oeis4.)