

A006892


Representation as a sum of squares requires n squares with greedy algorithm.
(Formerly M0860)


7



1, 2, 3, 7, 23, 167, 7223, 13053767, 42600227803223, 453694852221687377444001767, 51459754733114686962148583993443846186613037940783223
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

Of course Lagrange's theorem tells us that any positive integer can be written as a sum of at most four squares (cf. A004215).
Records in A053610.  Hugo van der Sanden, Jun 24 2015


REFERENCES

N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).


LINKS

Rick L. Shepherd, Table of n, a(n) for n = 1..15
Art of Problem Solving, 2010 AMC 10A Problems/Problem 25 [From Rick L. Shepherd, Jan 28 2014]
E. Lemoine, Décomposition d'un nombre entier N en ses puissances nièmes maxima, C. R. Acad. Sci. Paris, Vol. 95, pp. 719722, 1882 (then next pages).


FORMULA

For n >= 4, a(n) = a(n1) + ((a(n1)+1)/2)^2.  Joe K. Crump (joecr(AT)carolina.rr.com), Apr 16 2000
a(n) = n for n <= 3; for n > 3, a(n) = ((a(n1)+3)/2)^2  2.  Arkadiusz Wesolowski, Mar 30 2013
a(n+2) = 2 * A053630(n)  3.  Thomas Ordowski, Jul 14 2014
a(n+3) = A053630(n)^2  2.  Thomas Ordowski, Jul 19 2014


EXAMPLE

Here is why a(5) = 23: start with 23, subtract largest square <= 23, which is 16, getting 7.
Now subtract largest square <= 7, which is 4, getting 3.
Now subtract largest square <= 3, which is 1, getting 2.
Now subtract largest square <= 2, which is 1, getting 1.
Now subtract largest square <= 1, which is 1, getting 0.
Thus 23 = 16+4+1+1+1.
It took 5 steps to get to 0, and 23 is the smallest number which takes 5 steps.  N. J. A. Sloane, Jan 29 2014


PROG

(PARI) a(n) = if (n <= 3, n , ((a(n1)+3)/2)^2  2) \\ Michel Marcus, May 25 2013


CROSSREFS

Cf. A004215, A053610.
Sequence in context: A108176 A111235 A066356 * A296397 A102710 A048824
Adjacent sequences: A006889 A006890 A006891 * A006893 A006894 A006895


KEYWORD

nonn


AUTHOR

Jeffrey Shallit


EXTENSIONS

Four more terms from Rick L. Shepherd, Jan 27 2014


STATUS

approved



