A178007 Largest n-digit prime with the most digits equal to 9.
7, 97, 997, 9949, 99991, 999979, 9999991, 99999989, 999999929, 9999999929, 99999999599, 999999999989, 9999999999799, 99999999999959, 999999999999989, 9999999999999199, 99999999999999997, 999999999999999989, 9999999999999999919, 99999999999999999989, 999999999999999999899, 9999999999999999999929
Offset: 1
Links
- Robert Israel, Table of n, a(n) for n = 1..996
Programs
-
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
Extensions
Corrected and more terms by Robert Israel, Dec 16 2024
Comments