A379355 Beginning with 3, least prime such that the reversal concatenation of first n terms is prime.
3, 2, 2, 13, 2, 13, 59, 31, 263, 73, 23, 31, 449, 31, 59, 313, 2, 3, 211, 317, 31, 449, 241, 887, 349, 911, 853, 887, 313, 173, 1777, 179, 967, 503, 331, 113, 163, 359, 1153, 281, 97, 1823, 13, 23, 1657, 269, 223, 3623, 2017, 233, 61, 1361, 367, 1031, 79, 389, 577, 2963, 1741, 59, 13, 1439, 463, 797
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
w = {3}; 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, 57}]; w
-
Python
from itertools import count, islice from gmpy2 import digits, is_prime, mpz, next_prime def agen(): # generator of terms r, an = "", 3 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(), 57))) # Michael S. Branicky, Dec 21 2024
Comments