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”).

A158191
Attach the smallest prime to the end of the string a(n-1) so a(n) is also prime.
1
2, 23, 233, 2333, 23333, 2333323, 23333237, 233332373, 23333237353, 2333323735319, 2333323735319149, 2333323735319149571, 23333237353191495713, 23333237353191495713131, 233332373531914957131313
OFFSET
1,1
COMMENTS
a(279) has 1001 digits. - Michael S. Branicky, May 26 2023
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..278 (terms 1..200 from Harvey P. Dale)
EXAMPLE
a(6) = 2333323 since a(5) = 23333 (prime) and 233333, 233335, 233337, 2333311, 2333313, 2333317 and 2333319 are all composite.
MATHEMATICA
nxt[n_]:=Module[{k=3}, While[CompositeQ[n*10^IntegerLength[k]+k], k = NextPrime[ k]]; n*10^IntegerLength[k]+k]; NestList[nxt, 2, 20] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 13 2019 *)
PROG
(Python)
from itertools import islice
from sympy import isprime, nextprime
def agen(): # generator of terms
p, s = 2, "2"
while True:
yield p
q = 2
while not isprime(p:=int(s+str(q))):
q = nextprime(q)
s += str(q)
print(list(islice(agen(), 15))) # Michael S. Branicky, May 26 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Sergio Pimentel, Mar 13 2009
EXTENSIONS
More terms from Sean A. Irvine, Nov 29 2009
STATUS
approved