A053582
a(n+1) is the smallest prime ending with a(n), where a(1)=1.
Original entry on oeis.org
1, 11, 211, 4211, 34211, 234211, 4234211, 154234211, 3154234211, 93154234211, 2093154234211, 42093154234211, 342093154234211, 11342093154234211, 3111342093154234211, 63111342093154234211, 2463111342093154234211, 232463111342093154234211
Offset: 1
The least prime ending with seed 1 is 11; the least prime ending with 11 is 211; the least prime ending with 211 is 4211. - _Clark Kimberling_, Sep 17 2015
-
R:= 1: v:= 1:
for iter from 1 to 30 do
d:= ilog10(v)+1;
for x from v+10^d by 10^d do
if isprime(x) then R:= R, x; v:= x; break fi
od
od:
R; # Robert Israel, Sep 24 2020
-
f[n_] := f[n] = Block[{j = f[n - 1], k = 1, l = Floor[Log[10, f[n - 1]] + 1]}, While[m = k*10^l + j; ! PrimeQ@ m, k++ ]; m]; f[1] = 1; Array[f, 17]
nxt[n_]:=Module[{k=1,p=10^IntegerLength[n]},While[!PrimeQ[k*p+n],k++];k*p+n]; NestList[nxt,1,20] (* Harvey P. Dale, Jul 14 2016 *)
-
from sympy import isprime
from itertools import count, islice
def agen(an=1): # generator of terms
while True:
yield an
pow10 = 10**len(str(an))
for t in count(pow10+an, step=pow10):
if isprime(t):
an = t
break
print(list(islice(agen(), 18))) # Michael S. Branicky, Jun 23 2022
A053583
a(n+1) is the smallest prime ending with (but not equal to) a(n), where a(1)=3.
Original entry on oeis.org
3, 13, 113, 2113, 12113, 612113, 11612113, 1611612113, 111611612113, 1111611612113, 81111611612113, 2181111611612113, 132181111611612113, 11132181111611612113, 3411132181111611612113, 413411132181111611612113, 12413411132181111611612113
Offset: 1
-
A[1]:= 3;
for n from 2 to 100 do
d:= 10^(ilog10(A[n-1])+1);
for k from 1 do
p:= A[n-1]+d*k;
if isprime(p) then
A[n]:= p;
break
fi
od
od:
seq(A[n],n=1..100); # Robert Israel, Jul 15 2014
-
from sympy import isprime
from itertools import count, islice
def agen(an=3):
while True:
yield an
pow10 = 10**len(str(an))
for t in count(pow10+an, step=pow10):
if isprime(t):
an = t
break
print(list(islice(agen(), 17))) # Michael S. Branicky, Jun 23 2022
A069612
a(1) = 19 (the smallest prime ending in a 9) and a(n+1) = smallest prime ending in a(n).
Original entry on oeis.org
19, 419, 5419, 35419, 435419, 11435419, 111435419, 9111435419, 89111435419, 1389111435419, 81389111435419, 381389111435419, 15381389111435419, 3315381389111435419, 153315381389111435419, 22153315381389111435419, 2022153315381389111435419
Offset: 1
-
w=9; Table[w; i=1; While[PrimeQ[ToExpression[StringJoin[ToString[i], ToString[w]]]]==False, i++ ]; w=ToExpression[StringJoin[ToString[i], ToString[w]]], {32}]
nxt[n_]:=Module[{c=10^IntegerLength[n],x=1},While[!PrimeQ[c*x+n],x++];c*x+n]; NestList[nxt,19,15] (* Harvey P. Dale, Sep 25 2013 *)
-
from sympy import isprime
from itertools import count, islice
def agen(an=19):
while True:
yield an
pow10 = 10**len(str(an))
for t in count(pow10+an, step=pow10):
if isprime(t):
an = t
break
print(list(islice(agen(), 17))) # Michael S. Branicky, Jun 23 2022
A077715
a(1) = 7; thereafter a(n) = the smallest prime of the form d0...0a(n-1), where d is a single digit, or 0 if no such prime exists.
Original entry on oeis.org
7, 17, 317, 6317, 26317, 126317, 2126317, 72126317, 372126317, 5372126317, 305372126317, 9305372126317, 409305372126317, 20409305372126317, 100020409305372126317, 9100020409305372126317, 209100020409305372126317, 40209100020409305372126317
Offset: 1
-
a:= proc(n) option remember; local k, m, d, p;
if n=1 then 7 else k:= a(n-1);
for m from length(k) do
for d to 9 do p:= k +d*10^m;
if isprime(p) then return p fi
od od
fi
end:
seq(a(n), n=1..20); # Alois P. Heinz, Jan 12 2015
-
from sympy import isprime
from itertools import islice
def agen(an=7):
while True:
yield an
pow10 = 10**len(str(an))
while True:
found = False
for t in range(pow10+an, 10*pow10+an, pow10):
if isprime(t):
an = t; found = True; break
if found: break
pow10 *= 10
print(list(islice(agen(), 18))) # Michael S. Branicky, Jun 23 2022
Showing 1-4 of 4 results.
Comments