|
|
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
|
|
|
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
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|