login
A241834
Number of terms in the greedy residue sum for n^2.
4
1, 2, 3, 2, 3, 3, 4, 3, 3, 4, 4, 2, 3, 3, 4, 4, 4, 3, 3, 4, 4, 3, 4, 2, 3, 3, 4, 4, 4, 4, 5, 3, 3, 4, 4, 3, 4, 4, 5, 2, 3, 3, 4, 4, 4, 4, 5, 3, 4, 3, 3, 4, 4, 3, 4, 4, 5, 4, 4, 2, 3, 3, 4, 4, 4, 4, 5, 3, 4, 4, 5, 3, 3, 4, 4, 3, 4, 4, 5, 4, 4, 5, 5, 2, 3, 3
OFFSET
2,2
COMMENTS
Greedy residue sums are introduced at A241833.
LINKS
EXAMPLE
n ... n^2 ... a(n)
1 .. 1 .... (undefined)
2 ... 4 .... 1 = # terms in 1
3 ... 9 .... 2 = # the terms in 4 + 1
4 ... 16 ... 3 = # terms in 9 + 4 + 1
5 ... 25 ... 2 = # terms in 16 + 9
6 ... 36 ... 3 = # terms in 25 + 9 + 1
7 ... 49 ... 3 = # terms in 36 + 9 + 4
8 ... 64 ... 4 = # terms in 49 + 9 + 4 + 1
MATHEMATICA
z = 200; s = Table[n^2, {n, 1, z}]; t = Table[{s[[n]], #, Total[#] == s[[n]]} &[ DeleteCases[-Differences[FoldList[If[#1 - #2 >= 0, #1 - #2, #1] &, s[[n]], Reverse[Select[s, # < s[[n]] &]]]], 0]], {n, z}]; r[n_] := s[[n]] - Total[t[[n]][[2]]]; tr = Table[r[n], {n, 2, z}] (* A241833 *)
c = Table[Length[t[[n]][[2]]], {n, 2, z}] (* A241834 *)
f = 1 + Flatten[Position[tr, 0]] (* A241835 *)
f^2 (* A241836 *)
(* Peter J. C. Moses, May 06 2014 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 09 2014
STATUS
approved