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.

A261198 Start with n and repeat the map x -> x+sumdigits(x) until reaching a prime, which is a(n), or 0 if no prime is reached.

Original entry on oeis.org

2, 23, 0, 23, 11, 0, 19, 23, 0, 11, 13, 0, 17, 19, 0, 23, 37, 0, 29, 41, 0, 41, 101, 0, 37, 41, 0, 101, 59, 0, 43, 37, 0, 41, 43, 0, 47, 101, 0, 59, 67, 0, 89, 59, 0, 67, 71, 0, 101, 89, 0, 59, 61, 0, 89, 67, 0, 71, 73, 0, 103, 101, 0, 127, 89, 0, 109, 103, 0, 101, 79, 0, 83, 127, 0, 89, 101, 0, 109, 109, 0, 103, 107, 0, 127, 101, 0, 109, 113, 0, 101, 103, 0, 107, 109, 0, 113, 127, 0, 101
Offset: 1

Views

Author

Maghraoui Abdelkader, Sep 30 2015

Keywords

Comments

Multiples of 3 never reach a prime because (3*x + sumdigits(3*x)) is always a multiple of 3.

Examples

			a(3)=0; a(6)=0; a(9)=0  as 3,6,9 are multiples of 3.
n=2; a0=2; a1=2+sumdigits(2)=4; a2=4+sumdigits(4)=8; a3=8+sumdigits(8)=16;
a4=16+sumdigits(16)=16+7=23; a4 is prime, so a(2)=23;
a(14)=14+(1+4=19); 19 is prime.
a(16)=16+(1+6)=23; 23 is prime.
		

Crossrefs

Programs

  • PARI
    verif(n)={if((n%3)==0, print1(0,", ");return(););
    b=1; a=n;
    while(b<10, a=a+sumdigits(a) ;if(isprime(a),print1(a,", "); b=20))}
    for(n=1, 100, verif(n);)