login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A242293
Greedy residue sequence of cubes 2^3, 3^3, 4^3, ...
4
7, 18, 28, 25, 0, 1, 8, 0, 19, 15, 18, 0, 0, 19, 11, 15, 0, 0, 7, 9, 20, 27, 10, 0, 6, 0, 0, 15, 6, 11, 8, 9, 11, 6, 27, 10, 23, 0, 0, 0, 2, 2, 0, 9, 0, 9, 10, 0, 15, 27, 6, 17, 2, 21, 16, 0, 12, 5, 1, 17, 26, 6, 18, 6, 2, 0, 10, 1, 2, 14, 21, 10, 5, 17, 11
OFFSET
2,1
COMMENTS
Suppose that s = (s(1), s(2), ... ) is a sequence of real numbers such that for every real number u, at most finitely many s(i) are < u, and suppose that x > min(s). We shall apply the greedy algorithm to x, using terms of s. Specifically, let i(1) be an index i such that s(i) = max{s(j) < x}, and put d(1) = x - s(i(1)). If d(1) < s(i) for all i, put r = x - s(i(1)). Otherwise, let i(2) be an index i such that s(i) = max{s(j) < x - s(i(1))}, and put d(2) = x - s(i(1)) - s(i(2)). If d(2) < s(i) for all i, put r = x - s(i(1)) - s(i(2)). Otherwise, let i(3) be an index i such that s(i) = max{s(j) < x - s(i(1)) - s(i(2))}, and put d(3) = x - s(i(1)) - s(i(2)) - s(i(3)). Continue until reaching k such that d(k) < s(i) for every i, and put r = x - s(i(1)) - ... - s(i(k)). Call r the s-greedy residue of x, and call s(i(1)) + ... + s(i(k)) the s-greedy sum for x. If r = 0, call x s-greedy summable. If s(1) = min(s) < s(2), then taking x = s(i) successively for i = 2, 3,... gives a residue r(i) for each i; call (r(i)) the greedy residue sequence for s. When s is understood from context, the prefix "s-" is omitted. For A242293, s = (1^3, 2^3, 3^3, ...).
LINKS
EXAMPLE
n ... n^3 ... a(n)
1 ... 1 .... (undefined)
2 ... 8 ..... 7 = 8 - 1
3 ... 27 .... 18 = 27 - 8 - 1
4 ... 64 .... 28 = 64 - 27 - 8 - 1
5 ... 125 ... 25 = 125 - 64 - 27 - 8 - 1
6 ... 216 ... 0 = 216 - 125 - 64 - 27
7 ... 343 ... 1 = 343 - 216 - 125 - 1
8 ... 512 ... 8 = 512 - 125 - 27 - 8 - 1
9 ... 729 ... 0 = 729 - 512 - 216 - 1
MATHEMATICA
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}]
r[n_] := s[[n]] - Total[t[[n]][[2]]];
tr = Table[r[n], {n, 2, z}] (* A242293 *)
c = Table[Length[t[[n]][[2]]], {n, 2, z}] (* A242294 *)
f = 1 + Flatten[Position[tr, 0]] (* A242295*)
f^3 (* A242296 *) (* Peter J. C. Moses, May 06 2014 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 10 2014
STATUS
approved