OFFSET
1,1
COMMENTS
Leading zeros are not allowed, e.g., "03".
a(997) has 1001 digits. - Michael S. Branicky, Dec 16 2024
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..996
EXAMPLE
a(1) = 103, is the smallest prime ending in "03";
a(2) = 2003, is the smallest prime ending in "003".
MATHEMATICA
Table[i=1; While[!PrimeQ[m=FromDigits[Join[IntegerDigits[i], Table[0, n], {3}]]], i++]; m, {n, 19}] (* James C. McMahon, Dec 23 2024 *)
PROG
(Python)
import sympy
def prime3_finder():
outVec = []
power = 2
for n in range(100, 999999999):
if not n & 3 == 3: continue # speed-up over simple MOD operation
if not n % 10**power == 3: continue
if not sympy.isprime(n): continue
outVec.append(n)
power += 1
return outVec
outvec = prime3_finder()
print(outvec)
(Python)
from sympy import isprime
from itertools import count
def a(n): return next(i for i in count(10**(n+1)+3, 10**(n+1)) if isprime(i))
print([a(n) for n in range(1, 20)]) # Michael S. Branicky, Dec 16 2024
(PARI) a(n)=for(i=1, oo, if(isprime(i*10^(n+1)+3), return(i*10^(n+1)+3))) \\ Johann Peters, Dec 27 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
James S. DeArmon, Dec 16 2024
EXTENSIONS
More terms from Michael S. Branicky, Dec 16 2024
STATUS
approved