|
|
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.
|
|
4
|
|
|
7, 17, 317, 6317, 26317, 126317, 2126317, 72126317, 372126317, 5372126317, 305372126317, 9305372126317, 409305372126317, 20409305372126317, 100020409305372126317, 9100020409305372126317, 209100020409305372126317, 40209100020409305372126317
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
a(n) is the smallest prime obtained by prefixing a(n-1) with a number of the form d*10^k where d is a single digit, 0 < d < 10, and k >= 0. Conjecture: d*10^k always exists.
|
|
LINKS
|
|
|
MAPLE
|
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:
|
|
PROG
|
(Python)
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|