A077714
a(1) = 1; 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
1, 11, 211, 4211, 34211, 234211, 4234211, 304234211, 9304234211, 209304234211, 7209304234211, 37209304234211, 3037209304234211, 23037209304234211, 323037209304234211, 70000323037209304234211, 300070000323037209304234211, 600300070000323037209304234211
Offset: 1
a(8) = 304234211; deleting 3 gives 4234211 = a(7).
-
a:= proc(n) option remember; local k, m, d, p;
if n=1 then 1 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=1):
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
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
A077716
a(1) = 19; 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
19, 419, 5419, 35419, 435419, 80435419, 30000080435419, 1030000080435419, 91030000080435419, 20091030000080435419, 720091030000080435419, 50720091030000080435419, 650720091030000080435419, 10650720091030000080435419, 2000000010650720091030000080435419
Offset: 1
-
a:= proc(n) option remember; local k, m, d, p;
if n=1 then 19 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=19):
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(), 15))) # Michael S. Branicky, Jun 23 2022
Showing 1-3 of 3 results.
Comments