cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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
Offset: 1

Views

Author

Eric Angelini and Derek Orr, Nov 16 2020

Keywords

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.

Examples

			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.
		

Crossrefs

Cf. A338925.

Programs

  • 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