login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A241833 Greedy residue sequence of squares 2^2, 3^2, 4^2, ... 26
3, 4, 2, 0, 1, 0, 1, 0, 2, 0, 2, 0, 1, 0, 1, 3, 0, 0, 2, 0, 2, 0, 1, 0, 1, 0, 1, 3, 0, 2, 0, 0, 2, 0, 2, 0, 1, 0, 1, 0, 1, 0, 1, 3, 0, 2, 0, 0, 1, 0, 2, 0, 2, 0, 1, 0, 1, 0, 2, 0, 1, 0, 1, 3, 0, 2, 0, 0, 1, 0, 1, 0, 2, 0, 2, 0, 1, 0, 1, 0, 2, 0, 2, 0, 1, 0 (list; graph; refs; listen; history; text; internal format)
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 A241833, s = (1^2, 2^2, 3^2, 4^2, ... ).
LINKS
EXAMPLE
n ... n^2 .. a(n)
1 ... 1 .... (undefined)
2 ... 4 .... 3 = 4 - 1
3 ... 9 .... 4 = 9 - 4 - 1
4 ... 16 ... 2 = 16 - 9 - 4 - 1
5 ... 25 ... 0 = 25 - 16 - 9
6 ... 36 ... 1 = 36 - 25 - 9 - 1
7 ... 49 ... 0 = 49 - 36 - 9 - 4
8 ... 64 ... 1 = 64 - 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
Sequence in context: A123951 A123127 A167876 * A332096 A077451 A352770
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 09 2014
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 15:38 EDT 2024. Contains 371254 sequences. (Running on oeis4.)