cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A158191 #21 May 26 2023 12:14:27
%S A158191 2,23,233,2333,23333,2333323,23333237,233332373,23333237353,
%T A158191 2333323735319,2333323735319149,2333323735319149571,
%U A158191 23333237353191495713,23333237353191495713131,233332373531914957131313
%N A158191 Attach the smallest prime to the end of the string a(n-1) so a(n) is also prime.
%C A158191 a(279) has 1001 digits. - _Michael S. Branicky_, May 26 2023
%H A158191 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 A158191 a(6) = 2333323 since a(5) = 23333 (prime) and 233333, 233335, 233337, 2333311, 2333313, 2333317 and 2333319 are all composite.
%t A158191 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 A158191 (Python)
%o A158191 from itertools import islice
%o A158191 from sympy import isprime, nextprime
%o A158191 def agen(): # generator of terms
%o A158191     p, s = 2, "2"
%o A158191     while True:
%o A158191         yield p
%o A158191         q = 2
%o A158191         while not isprime(p:=int(s+str(q))):
%o A158191             q = nextprime(q)
%o A158191         s += str(q)
%o A158191 print(list(islice(agen(), 15))) # _Michael S. Branicky_, May 26 2023
%Y A158191 Cf. A048549, A088603, A089703, A065712, A100893.
%K A158191 nonn,base
%O A158191 1,1
%A A158191 _Sergio Pimentel_, Mar 13 2009
%E A158191 More terms from _Sean A. Irvine_, Nov 29 2009