login
A071362
Smallest n-digit prime with strictly increasing digits.
7
2, 13, 127, 1237, 12347, 123457, 1234789, 12356789
OFFSET
1,1
PROG
(PARI) A071362(n, u=vectorv(n, i, 10^(n-i)))=forvec(d=vector(n, i, [1, 9]), isprime(d*u)&&return(d*u), 2) \\ M. F. Hasler, May 04 2017
(Python)
from sympy import nextprime
def inc(n):
s = str(n); return len(s)==1 or all(d>pd for pd, d in zip(s[:-1], s[1:]))
def a(n):
p = nextprime(10**(n-1))
while not inc(p): p = nextprime(p)
return p
for n in range(1, 9):
print(a(n), end=", ") # Michael S. Branicky, Feb 13 2021
CROSSREFS
KEYWORD
base,fini,full,nonn
AUTHOR
Rick L. Shepherd, May 21 2002
STATUS
approved