A384873 a(n) is the smallest n-digit zeroless prime.
2, 11, 113, 1117, 11113, 111119, 1111151, 11111117, 111111113, 1111111121, 11111111113, 111111111149, 1111111111139, 11111111111123, 111111111111229, 1111111111111123, 11111111111111119, 111111111111111131, 1111111111111111111, 11111111111111111131
Offset: 1
Examples
The list of 3-digit prime numbers starts with 101, 103, 107, 109, and 113. Among these, 113 is the first that does not contain the digit 0. So, a(3) = 113.
Links
- Gonzalo MartÃnez, Table of n, a(n) for n = 1..100
Programs
-
Maple
f:= proc(n) local x; for x from (10^n-1)/9 by 2 do if isprime(x) and not member(0,convert(x,base,10)) then return x fi od end proc: f(1):= 2: map(f, [$1..20]); # Robert Israel, Jun 12 2025
-
Mathematica
a[n_]:=Module[{k=PrimePi[10^n/9-1]},Until[DigitCount[Prime[k],10,0]==0,k++];Prime[k]] (* James C. McMahon, Jun 21 2025 *)
-
PARI
a(n) = forprime(p=(10^n-1)/9, , if (vecmin(digits(p)), return(p))); \\ Michel Marcus, Jun 15 2025
-
Python
from itertools import product from sympy import isprime def a(n): for t in product('123456789', repeat=n): p = int(''.join(t)) if isprime(p): return p print([a(n) for n in range(1, 21)])
-
Python
from sympy import nextprime def A384873(n): m = nextprime((10**n-1)//9-1) while '0' in str(m): m = nextprime(m) return m # Chai Wah Wu, Jun 20 2025
Comments