login
This site is supported by donations to The OEIS Foundation.

 

Logo

Please make a donation to keep the OEIS running. We are now in our 55th year. In the past year we added 12000 new sequences and reached 8000 citations (which often say "discovered thanks to the OEIS"). We need to raise money to hire someone to manage submissions, which would reduce the load on our editors and speed up editing.
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A242252 Start with n-th odd prime, and repeatedly subtract the greatest prime until either 0 or 1 remains.  (The result is the "primes-greedy residue" of the n-th odd prime, which is "primes-greedy summable" if its residue = 0, as at A242255; see Comments.) 8

%I

%S 1,0,0,1,0,1,0,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,0,0,

%T 0,1,1,1,1,1,0,0,0,1,0,1,1,1,0,1,1,0,0,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,

%U 0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1

%N Start with n-th odd prime, and repeatedly subtract the greatest prime until either 0 or 1 remains. (The result is the "primes-greedy residue" of the n-th odd prime, which is "primes-greedy summable" if its residue = 0, as at A242255; see Comments.)

%C 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 A242252, s = (2,3,5,7,11, ... ) = A000040.

%H Clark Kimberling, <a href="/A242252/b242252.txt">Table of n, a(n) for n = 1..2000</a>

%e n ... n-th odd prime ... a(n)

%e 1 ... 3 ................ 1 = 3 - 2

%e 2 ... 5 ................ 0 = 5 - 3 - 2

%e 3 ... 7 ................ 0 = 7 - 5 - 2

%e 4 ... 11 ............... 1 = 11 - 7 - 3

%e 5 ... 13 ............... 0 = 13 - 11 - 2

%e 34 .. 149 .............. 1 = 149 - 139 - 7 - 2

%t z = 200; s = Table[Prime[n], {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}] (* A242252 *)

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

%t f = 1 + Flatten[Position[tr, 0]] (* A242254 *)

%t Prime[f] (* A242255 *)

%t f1 = Prime[Complement[Range[Max[f]], f]] (* A242256 *)

%t (* _Peter J. C. Moses_, May 06 2014 *)

%Y Cf. A242253, A242254, A242255, A242256, A241833, A000040.

%K nonn,easy

%O 1

%A _Clark Kimberling_, May 09 2014

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 10 12:30 EST 2019. Contains 329895 sequences. (Running on oeis4.)