[go: up one dir, main page]

login
Revision History for A242305 (Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing all changes.
Squares-greedy residue of n.
(history; published version)
#5 by N. J. A. Sloane at Tue May 20 23:48:01 EDT 2014
STATUS

proposed

approved

#4 by Clark Kimberling at Fri May 16 16:21:35 EDT 2014
STATUS

editing

proposed

#3 by Clark Kimberling at Sun May 11 17:19:43 EDT 2014
NAME

allocated for Clark KimberlingSquares-greedy residue of n.

DATA

1, 2, 3, 0, 1, 2, 3, 4, 0, 1, 2, 0, 0, 1, 2, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 1, 0, 1, 2, 0, 0, 1, 2, 3, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 1

OFFSET

2,2

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.

LINKS

Clark Kimberling, <a href="/A242305/b242305.txt">Table of n, a(n) for n = 2..2000</a>

EXAMPLE

n ... a(n)

1 ... (undefined)

2 ... 1 = 2 - 1

3 ... 2 = 3 - 1

4 ... 3 = 4 - 1

5 ... 0 = 5 - 4 - 1

6 ... 1 = 6 - 4 - 1

7 ... 2 = 7 - 4 - 1

8 ... 3 = 8 - 4 - 1

9 ... 4 = 9 - 4 - 1

10 .. 0 = 10 - 9 - 1

11 .. 1 = 11 - 9 - 1

12 .. 2 = 12 - 9 - 1

13 .. 0 = 13 - 9 - 4

MATHEMATICA

z = 200; s = Table[n^2, {n, 1, z}]; s1 = Table[n, {n, 1, z}]; t = Table[{s1[[n]], #, Total[#] == s1[[n]]} &[DeleteCases[-Differences[FoldList[If[#1 - #2 >= 0, #1 - #2, #1] &, s1[[n]],

Reverse[Select[s, # < s1[[n]] &]]]], 0]], {n, z}]

r[n_] := s1[[n]] - Total[t[[n]][[2]]];

tr = Table[r[n], {n, 2, z}] (* A242305 *)

c = Table[Length[t[[n]][[2]]], {n, 2, z}] (* A242306 *)

f = 1 + Flatten[Position[tr, 0]] (* A242307 *) (* Peter J. C. Moses, May 06 2014 *)

CROSSREFS
KEYWORD

allocated

nonn,easy

AUTHOR

Clark Kimberling, May 11 2014

STATUS

approved

editing

#2 by Clark Kimberling at Sat May 10 15:11:45 EDT 2014
KEYWORD

allocating

allocated

#1 by Clark Kimberling at Sat May 10 15:11:45 EDT 2014
NAME

allocated for Clark Kimberling

KEYWORD

allocating

STATUS

approved