A069661 Smallest n-digit prime with maximum digit sum.
7, 89, 997, 8999, 98999, 989999, 9899999, 89999999, 998999999, 9899989999, 98999999999, 999998999999, 8998999999999, 99899999999999, 999999899999999, 9998999999999999, 99999999999899999, 999998999999999999, 9998999999999999999, 89999999999999999999
Offset: 1
Crossrefs
Programs
-
Mathematica
Table[max=0; Do[p=Prime[i]; If[Total[IntegerDigits[p]] > Total[IntegerDigits[max]], max=p], {i,PrimePi[10^n]+1, PrimePi[10^(n+1)]}]; max, {n,0,7}] (* Jayanta Basu, May 19 2013 *)
Extensions
Corrected and extended by Rick L. Shepherd, Jul 15 2002. a(5) through a(20) have been certified prime with Primo.