editing
approved
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”).
editing
approved
P:=proc(q, h) local a, b, c, d, n; a:=h; b:=1; print(1);
for n from 1 to q do if isprime(n) then if a=(n mod 10^b) then print(n);
a:=n; d:=a; b:=0; while d>0 do b:=b+1; d:=trunc(d/10);
od; fi; fi; od; end: P(10^25, 1); # Paolo P. Lava, Jul 15 2014
# Alternative:
approved
editing
reviewed
approved
proposed
reviewed
editing
proposed
1, 11, 211, 4211, 34211, 234211, 4234211, 154234211, 3154234211, 93154234211, 2093154234211, 42093154234211, 342093154234211, 11342093154234211, 3111342093154234211, 63111342093154234211, 2463111342093154234211, 232463111342093154234211
(Python)
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
approved
editing
reviewed
approved
proposed
reviewed
editing
proposed
# Alternative:
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