A379354 Beginning with 3, least prime such that concatenation of first n terms is prime.
3, 7, 3, 3, 7, 29, 43, 11, 61, 71, 19, 191, 43, 53, 7, 239, 31, 173, 43, 137, 79, 53, 13, 557, 619, 47, 271, 797, 463, 83, 211, 467, 229, 131, 199, 359, 1249, 887, 853, 641, 109, 257, 1153, 1031, 613, 953, 607, 641, 499, 359, 1297, 1031, 2137, 401, 283, 29, 1321, 1499, 547, 83, 397, 2153, 1759, 1277
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 /@ 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 s, an = "", 3 while True: yield int(an) s += digits(an) p = 3 while not is_prime(mpz(s+digits(p))): p = next_prime(p) an = p print(list(islice(agen(), 57))) # Michael S. Branicky, Dec 21 2024