login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A158191 Attach the smallest prime to the end of the string a(n-1) so a(n) is also prime. 1

%I #21 May 26 2023 12:14:27

%S 2,23,233,2333,23333,2333323,23333237,233332373,23333237353,

%T 2333323735319,2333323735319149,2333323735319149571,

%U 23333237353191495713,23333237353191495713131,233332373531914957131313

%N Attach the smallest prime to the end of the string a(n-1) so a(n) is also prime.

%C a(279) has 1001 digits. - _Michael S. Branicky_, May 26 2023

%H Michael S. Branicky, <a href="/A158191/b158191.txt">Table of n, a(n) for n = 1..278</a> (terms 1..200 from Harvey P. Dale)

%e a(6) = 2333323 since a(5) = 23333 (prime) and 233333, 233335, 233337, 2333311, 2333313, 2333317 and 2333319 are all composite.

%t 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 *)

%o (Python)

%o from itertools import islice

%o from sympy import isprime, nextprime

%o def agen(): # generator of terms

%o p, s = 2, "2"

%o while True:

%o yield p

%o q = 2

%o while not isprime(p:=int(s+str(q))):

%o q = nextprime(q)

%o s += str(q)

%o print(list(islice(agen(), 15))) # _Michael S. Branicky_, May 26 2023

%Y Cf. A048549, A088603, A089703, A065712, A100893.

%K nonn,base

%O 1,1

%A _Sergio Pimentel_, Mar 13 2009

%E More terms from _Sean A. Irvine_, Nov 29 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 16:38 EDT 2024. Contains 371916 sequences. (Running on oeis4.)