A127889
Smallest n-digit right-truncatable prime.
Original entry on oeis.org
2, 23, 233, 2333, 23333, 233993, 2339933, 23399339
Offset: 1
-
A127889=vector(8, n, p=concat(apply(t->primes([t, t+1]*10), if(n>1, p))); p[1]) \\ M. F. Hasler, Nov 07 2018
A088604
a(n) = smallest prime in which n substrings containing the least significant digit are primes.
Original entry on oeis.org
2, 13, 113, 1223, 12113, 121283, 1237547, 12184967, 124536947, 1219861613, 12181833347, 121339693967, 1213536676883, 12673876537547, 121848768729173, 1275463876537547, 12429121339693967, 165678739293946997
Offset: 1
a(4) = 1223 in which the four substrings containing the LSD (3,23,223,1223) are primes.
-
f(n, d, digs, spare) = local(p, r, found); if (!d, return(n)); found = 0; for (i = 0, 9, p = n + i*10^digs; if ((i && isprime(p)) || spare, r = f(p, d - 1, digs + 1, spare - 1 + (i && isprime(p)))); if (r && (r < found || !found), found = r)); found;
a(n) = local(i, r); i = 0; while (1, r = f(0, n + i, 0, i); if (r, return(r), i++)); \\ David Wasserman, Aug 12 2005
A100893
a(n) = smallest n-digit prime formed by appending a digit to a(n-1); a(1) = 2.
Original entry on oeis.org
2, 23, 233, 2333, 23333
Offset: 1
a(1)=2
a(2)=23
a(3)=233
a(4)=2333
a(5)=23333
A158191
Attach the smallest prime to the end of the string a(n-1) so a(n) is also prime.
Original entry on oeis.org
2, 23, 233, 2333, 23333, 2333323, 23333237, 233332373, 23333237353, 2333323735319, 2333323735319149, 2333323735319149571, 23333237353191495713, 23333237353191495713131, 233332373531914957131313
Offset: 1
a(6) = 2333323 since a(5) = 23333 (prime) and 233333, 233335, 233337, 2333311, 2333313, 2333317 and 2333319 are all composite.
-
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 *)
-
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
Showing 1-4 of 4 results.
Comments