login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Largest n-digit prime with only prime digits.
1

%I #23 Jun 19 2023 09:20:01

%S 7,73,773,7757,77773,777737,7777753,77777377,777777773,7777777577,

%T 77777777573,777777777773,7777777777573,77777777777753,

%U 777777777777773,7777777777777753,77777777777775557,777777777777777737,7777777777777777577,77777777777777777257,777777777777777777773,7777777777777777773533,77777777777777777775353

%N Largest n-digit prime with only prime digits.

%C Terms a(5) through a(23) have been certified prime with Primo.

%H Michael S. Branicky, <a href="/A071060/b071060.txt">Table of n, a(n) for n = 1..1000</a>

%F Conjecture: a(n) ~ floor((7/9) * 10^n). - _Bill McEachen_, Apr 07 2023

%o (Python)

%o from sympy import isprime

%o from itertools import product

%o 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))

%o print([a(n) for n in range(1, 24)]) # _Michael S. Branicky_, Apr 29 2023

%o (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

%Y Cf. A069837.

%K base,nonn

%O 1,1

%A _Rick L. Shepherd_, May 26 2002