%I #4 May 15 2014 10:17:09
%S 1,2,3,4,3,3,5,3,5,6,5,4,4,6,6,5,5,3,5,6,5,6,7,5,4,6,4,5,5,5,5,6,7,5,
%T 6,7,6,4,6,3,6,7,5,6,6,6,7,6,6,6,6,6,6,7,6,7,6,4,5,7,7,5,7,6,6,7,7,6,
%U 6,6,7,5,5,5,6,7,7,7,6,6,5,4,6,5,6,5
%N Number of terms in the greedy sum for n^3.
%C Greedy residues and related numbers are defined at A242293.
%H Clark Kimberling, <a href="/A242294/b242294.txt">Table of n, a(n) for n = 2..2000</a>
%e n ... n^3 .. greedy sum
%e 1 .. 1 .... (undefined)
%e 2 ... 8 .... 1 = 1
%e 3 ... 27 ... 9 = 8 + 1
%e 4 ... 64 ... 36 = 27 + 8 + 1
%e 5 ... 125 .. 100 = 64 + 27 + 8 + 1
%e 6 ... 216 .. 216 = 125 + 64 + 27
%e 7 ... 343 .. 342 = 216 + 125 + 1
%e 8 ... 512 .. 504 = 343 + 125 + 27 + 8 + 1
%e 9 ... 729 .. 729 = 512 + 216 + 1
%t z = 200; s = Table[n^3, {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}]
%t r[n_] := s[[n]] - Total[t[[n]][[2]]];
%t tr = Table[r[n], {n, 2, z}] (* A242293 *)
%t c = Table[Length[t[[n]][[2]]], {n, 2, z}] (* A242294 *)
%t f = 1 + Flatten[Position[tr, 0]] (* A242295*)
%t f^3 (* A242296 *) (* _Peter J. C. Moses_, May 06 2014 *)
%Y Cf. A242293, A242295, A242296, A241833, A242284, A000578.
%K nonn,easy
%O 2,2
%A _Clark Kimberling_, May 10 2014
|