|
|
A338938
|
|
a(1)=0. For n >= 2, let S be the sum of all nonprime digits in a(1), a(2), ... a(n-1) and let P be the next prime not already in the sequence. If S is a nonprime number less than P and not already in the sequence, a(n) = S. Otherwise, a(n) = P.
|
|
1
|
|
|
0, 2, 3, 5, 7, 11, 13, 17, 4, 8, 16, 19, 23, 29, 31, 37, 41, 43, 47, 53, 56, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Similar to A338925, however this sequence does not include the nonprime digits of a(n) itself.
Each nonprime term is the sum of all nonprime digits of each previous term.
|
|
LINKS
|
|
|
EXAMPLE
|
a(9) = 4 since the sum of the nonprime digits of the previous terms is 1+1+1+1 = 4 and 4 is less than the next prime, 19.
a(10) = 8 since the sum of nonprime digits of the previous terms is 1+1+1+1+4 = 8 and 8 is less than the next prime, 19.
a(11) = 16 since the sum of the nonprime digits of the previous terms is 1+1+1+1+4+8 = 16 and 16 is less than the next prime, 19.
Now, the sum of the nonprime digits of the previous terms is 1+1+1+1+4+8+1+6 = 23 (a prime number). So a(12) is the next prime number in that hasn't appeared, meaning a(12) = 19.
|
|
PROG
|
(PARI) my(v=[0], w=[0], n=1, p=1, m, c); while(n<125, q=vecsum(w); m=[]; p=nextprime(p); c=0; for(k=1, #digits(q), if(!isprime(digits(q)[k]), m=concat(m, digits(q)[k]))); if(!isprime(q)&&(q<p)&& !vecsearch(vecsort(v), q), v=concat(v, q); w=concat(w, m); c++); if(c==0, for(j=1, #digits(p), if(!isprime(digits(p)[j]), w=concat(w, digits(p)[j]))); v=concat(v, p); p++); n++); v
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|