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!)
A282846 Start with a(0) = 0, c = 1, p = 2. Thereafter, if a(n) < c, then a(n+1) = a(n) + p and p is set to the next larger prime; else, a(n+1) = a(n) - c and c is set to the next larger composite number. 7
0, 2, 1, 4, 0, 5, 12, 6, 17, 9, 0, 13, 3, 20, 8, 27, 13, 36, 21, 5, 34, 16, 47, 27, 6, 43, 21, 62, 38, 13, 56, 30, 3, 50, 22, 75, 45, 13, 72, 39, 5, 66, 31, 98, 62, 24, 95, 56, 16, 89, 47, 3, 82, 37, 120, 74, 26, 115, 66, 16, 113, 62, 10, 111, 57, 2, 105, 49, 156, 99, 41, 150, 90, 28, 141, 78, 14, 141, 76, 10, 141, 73, 4, 141, 71, 210, 138, 64, 213 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
First differences are primes and negative nonprimes; their absolute values yield a permutation of the positive integers.
See A282864 for the permutation of the nonnegative integers corresponding to the order in which the numbers are used in this sequence.
LINKS
M. F. Hasler, Table of n, a(n) for n = 0..10000 (a(0..5000) from Jean-Marc Falcoz.)
E. Angelini, Le restaurant new-yorkais, February 2017
PROG
(PARI) A282846(n, s=0, a=0, c=1, p=2)={for(n=1, n, s&&print1(a", "); if(a<c, a+=p; p=nextprime(p+1), a-=c; while(isprime(c++), ))); a} \\ Set 2nd argument s to 1 to print all intermediate terms.
CROSSREFS
Sequence in context: A087664 A158032 A282886 * A326129 A336566 A326144
KEYWORD
nonn,look
AUTHOR
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 April 25 07:53 EDT 2024. Contains 371964 sequences. (Running on oeis4.)