login
A178007
Largest n-digit prime with the most digits equal to 9.
2
7, 97, 997, 9949, 99991, 999979, 9999991, 99999989, 999999929, 9999999929, 99999999599, 999999999989, 9999999999799, 99999999999959, 999999999999989, 9999999999999199, 99999999999999997, 999999999999999989, 9999999999999999919, 99999999999999999989, 999999999999999999899, 9999999999999999999929
OFFSET
1,1
COMMENTS
First maximum the number of 9's, then choose the largest.
From Robert Israel, Dec 18 2024: (Start)
This is believed to be different from A241206, as there should be infinitely many n for which there is no n-digit prime with n-1 digits equal to 9. No examples are known; the least such n is greater than 3400. (End)
LINKS
MAPLE
f:= proc(n) local i, j, a, b, x, y;
x:= 10^n-1;
for i from 0 to n-1 do
for a from 1 to 9 do
y:= x - a*10^i;
if isprime(y) then return y fi;
od od;
for i from 1 to n-1 do
for a from 1 to 9 do
for j from 0 to i-1 do
for b from 1 to 9 do
y:= x - a*10^i - b*10^j;
if isprime(y) then return y fi
od od od od;
FAIL
end proc:
map(f, [$1..30]); # Robert Israel, Dec 16 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Lekraj Beedassy, May 17 2010
EXTENSIONS
Corrected and more terms by Robert Israel, Dec 16 2024
STATUS
approved