login
A300186
Largest digit sum among all n-digit primes.
0
7, 17, 25, 35, 44, 53, 62, 71, 80, 88, 98, 107, 115, 125, 134, 143, 152, 161, 170, 179, 188, 197, 206, 215, 223, 233, 242, 250, 260, 269, 278, 287, 296, 304, 314, 323, 332, 341, 350, 359, 367, 377, 386, 394, 404, 413, 421, 431, 440, 449, 458, 466, 476, 485, 494
OFFSET
1,1
COMMENTS
Largest value of A007605(x) for any integer x in the interval [A090226(n), A090226(n+1)-1].
Trivially, 1 < a(n) < 9*n = A008591(n). The lower bound follows, since a prime > 10 must contain at least two nonzero digits, with the least possible digit sum 2. The upper bound follows because 10^n-1 is always composite and thus the digit sum can be at most A017257(n-1). The maximal possible value is reached by a(n) iff a term t exists in A263431 such that A055642(t) = n-1.
EXAMPLE
For n = 2: Among all 2-digit primes, the largest possible digit sum is 8+9 = 17, which is achieved by the prime 89, so a(2) = 17.
PROG
(PARI) a(n) = my(r=0); forprime(p=10^(n-1), 10^n, if(sumdigits(p) > r, r=sumdigits(p))); r
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Felix Fröhlich, Feb 28 2018
EXTENSIONS
More terms from Alois P. Heinz, Feb 28 2018
STATUS
approved