OFFSET
1,1
COMMENTS
Using Dirichlet's theorem, we conclude that every term exists. So the sequence is a permutation of the odd primes other than 5. Indeed, an odd prime p other than 5 is either in its natural place in A045572 or appears earlier than that.
LINKS
FORMULA
MAPLE
r:= -1: Used:= 'Used':
for n from 1 to 1000 do
r:= r+2;
if r mod 5 = 0 then r:= r+2 fi;
d:= 10^(1+ilog10(r));
for x from r by d do
if isprime(x) and not assigned(Used[x]) then
a[n]:= x;
Used[x]:= true;
break
fi
od
od:
seq(a[n], n=1..1000); # Robert Israel, May 27 2015
PROG
(PARI) \\with first line from A045572 by Charles R Greathouse IV
a(n) = {n = 10*(n>>2)+[-1, 1, 3, 7][n%4+1]; my(d = digits(n), m = matrix(#d + 1, 2), w=0); m[1, 2] = d[#d] - 10; for(i = 2, matsize(m)[1], m[i, 1]=10^(i-2)*d[#d-i+2] + m[i-1, 1]; if(m[i-1, 1] == m[i, 1], m[i, 2]=m[i-1, 2], j=m[i, 1]==m[i-1, 2]; while(!isprime(10^(i-1)*j+m[i, 1]), j++); m[i, 2]=10^(i-1)*j+m[i, 1])); m[matsize(m)[1], 2]} \\ David A. Corneth, May 25 2015
(Python)
from sympy import isprime
def aupton(terms):
alst, aset = [], set()
for n in range(1, terms+1):
ending = 2*n - 1 + (n+1)//4 * 2 # A045572
i, pow10 = ending, 10**len(str(ending))
while i in aset or not isprime(i): i += pow10
alst.append(i); aset.add(i)
return alst
print(aupton(68)) # Michael S. Branicky, Nov 03 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Vladimir Shevelev, May 23 2015
STATUS
approved