A071060 Largest n-digit prime with only prime digits.
7, 73, 773, 7757, 77773, 777737, 7777753, 77777377, 777777773, 7777777577, 77777777573, 777777777773, 7777777777573, 77777777777753, 777777777777773, 7777777777777753, 77777777777775557, 777777777777777737, 7777777777777777577, 77777777777777777257, 777777777777777777773, 7777777777777777773533, 77777777777777777775353
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..1000
Crossrefs
Cf. A069837.
Programs
-
PARI
genit(nstrt=1,cownt=23)={my(arr=List());for(n=nstrt, nstrt+cownt, my(cand=0); for(i=1,n,cand=10*cand+7); if(ispseudoprime(cand)==1, listput(arr,cand);next); for(j=1,+oo,cand=precprime(cand-1); my(v=digits(cand), pass=1); for(ptr=1, #v, my(q=v[ptr]); if(q==2||q==3||q==5||q==7,next);pass=0;break);if(pass>0,break)); listput(arr,cand)); Vec(arr)} \\ Bill McEachen, Apr 29 2023
-
Python
from sympy import isprime from itertools import product def a(n): return next(t for t in (int("".join(p)+e) for p in product("7532", repeat=n-1) for e in "73") if isprime(t)) print([a(n) for n in range(1, 24)]) # Michael S. Branicky, Apr 29 2023
Formula
Conjecture: a(n) ~ floor((7/9) * 10^n). - Bill McEachen, Apr 07 2023
Comments