login
A380011
Beginning with 7, least prime such that the reversal concatenation of the first n terms is prime.
2
7, 3, 3, 13, 3, 2, 13, 47, 43, 47, 37, 41, 109, 41, 139, 149, 109, 263, 73, 563, 163, 41, 19, 797, 61, 107, 31, 821, 43, 149, 37, 953, 211, 89, 547, 353, 337, 167, 67, 239, 1009, 449, 97, 23, 349, 41, 31, 911, 61, 929, 229, 797, 331, 191, 463, 107, 463, 809, 2887, 971
OFFSET
1,1
COMMENTS
"Reverse concatenation" here refers to the decimal concatenation R(a(n)) || R(a(n-1)) || ... || R(a(3)) || R(a(2)) || R(a(1)) where R(k) means "reverse digits of k".
LINKS
J.W.L. (Jan) Eerland, Table of n, a(n) for n = 1..982
MATHEMATICA
w={7}; Do[k=1; q=Monitor[Parallelize[While[True, If[PrimeQ[FromDigits[Join@@IntegerDigits/@Reverse[IntegerDigits[FromDigits[Join@@IntegerDigits/@Append[w, Prime[k]]]]]]], Break[]]; k++]; Prime[k]], k]; w=Append[w, q], {i, 2, 50}]; w
PROG
(Python)
from itertools import count, islice
from gmpy2 import digits, is_prime, mpz, next_prime
def agen(): # generator of terms
r, an = "", 7
while True:
yield int(an)
r = digits(an)[::-1] + r
p = 2
while not is_prime(mpz(digits(p)[::-1]+r)): p = next_prime(p)
an = p
print(list(islice(agen(), 50))) # after Michael S. Branicky in A379355
KEYWORD
base,nonn
AUTHOR
STATUS
approved