The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A062535 Don't be greedy! Difference between number of squares needed to sum to n using the greedy algorithm and using the best such sum. 5
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 2, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 2, 1, 0, 0, 0, 2, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,32 LINKS G. C. Greubel, Table of n, a(n) for n = 1..5000 FORMULA a(n) = A053610(n) - A002828(n). EXAMPLE a(32)=5-2=3 since 32 can be written greedily as 25+4+1+1+1 or efficiently as 16+16. MATHEMATICA f[n_] := (n - Floor[Sqrt[n]]^2); a053610[n_] := (m = n; c = 1; While[a = f[m]; a != 0, c++; m = a]; c); SquareCnt[n_] := If[SquaresR[1, n] > 0, 1, If[SquaresR[2, n] > 0, 2, If[SquaresR[3, n] > 0, 3, 4]]]; (* a002828 *) Table[a053610[n] - SquareCnt[n], {n, 1, 100}] (* G. C. Greubel, Apr 18 2017 *) CROSSREFS Sequence in context: A280051 A030121 A320659 * A063667 A171063 A308229 Adjacent sequences:  A062532 A062533 A062534 * A062536 A062537 A062538 KEYWORD nonn AUTHOR Henry Bottomley, Jun 25 2001 STATUS approved

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

Last modified September 21 04:58 EDT 2020. Contains 337267 sequences. (Running on oeis4.)