%I #10 Mar 01 2018 09:13:23
%S 7,17,25,35,44,53,62,71,80,88,98,107,115,125,134,143,152,161,170,179,
%T 188,197,206,215,223,233,242,250,260,269,278,287,296,304,314,323,332,
%U 341,350,359,367,377,386,394,404,413,421,431,440,449,458,466,476,485,494
%N Largest digit sum among all n-digit primes.
%C Largest value of A007605(x) for any integer x in the interval [A090226(n), A090226(n+1)-1].
%C 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.
%e 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.
%o (PARI) a(n) = my(r=0); forprime(p=10^(n-1), 10^n, if(sumdigits(p) > r, r=sumdigits(p))); r
%Y Cf. A007605, A008591, A017257, A055642, A090226, A263431.
%K nonn,base
%O 1,1
%A _Felix Fröhlich_, Feb 28 2018
%E More terms from _Alois P. Heinz_, Feb 28 2018