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.

A345338 Integers whose Reverse And Add trajectory reaches its first prime after a record number of iterations (at least one iteration must be performed).

Original entry on oeis.org

1, 5, 181, 10031, 1001320
Offset: 1

Views

Author

Daniel Starodubtsev, Jun 14 2021

Keywords

Comments

a(6) > 10^9 (if it exists).
All numbers whose trajectory reaches a multiple of 3 or 11 before reaching a prime will never reach a prime.

Examples

			a(3) = 181 because it takes 3 iterations (181 -> 362 -> 625 -> 1151 (prime)) to reach a prime, which is more than any smaller number.
		

Crossrefs

Cf. A056964.

Programs

  • PARI
    f(n) = my(t=n, c=1); while(!isprime(t+=fromdigits(Vecrev(digits(t)))), if(gcd(t, 33)>1, return(0)); c++); c;
    lista(nn) = my(m); for(k=1, nn, if(f(k)>m, print1(k, ", "); m=f(k))); \\ Jinyuan Wang, Jun 15 2021
    
  • Python
    from sympy import isprime
    def ra(n): s = str(n); return int(s) + int(s[::-1])
    def afind(limit):
        record = 0
        for k in range(limit+1):
            m, i = ra(k), 1
            while not isprime(m) and m%3 != 0 and m%11 != 0: m = ra(m); i += 1
            if isprime(m) and i > record: record = i; print(k, end=", ")
    afind(1234567) # Michael S. Branicky, Jul 03 2021