login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A345338
Integers whose Reverse And Add trajectory reaches its first prime after a record number of iterations (at least one iteration must be performed).
0
1, 5, 181, 10031, 1001320
OFFSET
1,2
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.
EXAMPLE
a(3) = 181 because it takes 3 iterations (181 -> 362 -> 625 -> 1151 (prime)) to reach a prime, which is more than any smaller number.
PROG
(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
CROSSREFS
Cf. A056964.
Sequence in context: A027572 A050239 A218690 * A256286 A304277 A208403
KEYWORD
nonn,base,more
AUTHOR
Daniel Starodubtsev, Jun 14 2021
STATUS
approved