login
A373914
a(n) is the largest digit sum of all n-digit fourth powers.
5
1, 9, 13, 19, 25, 37, 43, 52, 55, 70, 76, 79, 85, 99, 103, 108, 118, 127, 135, 142, 144, 153, 171, 166, 178, 181, 189, 198, 205, 211, 220, 232, 234, 243, 252, 261, 265, 274, 279, 283, 297, 298, 313, 316, 325, 334, 337, 346, 358
OFFSET
1,2
EXAMPLE
a(3) = 13 because 13 is the largest digital sum encountered among all 3-digit fourth powers (attained at both fourth powers: 256, 625).
MATHEMATICA
Table[Max@Map[Total@IntegerDigits[#^4] &, Range[Ceiling[10^((n - 1)/4)], Floor[(10^n-1)^(1/4)]]], {n, 32}]
PROG
(PARI) a(n) = my(m=ceil(10^((n-1)/4)), M=sqrtint(sqrtint(10^n))); vecmax(apply(sumdigits, vector(M-m+1, i, (i+m-1)^4))); \\ Michel Marcus, Jun 23 2024
(Python)
from sympy import integer_nthroot
def A373914(n): return max(sum(int(d) for d in str(m**4)) for m in range((lambda x:x[0]+(x[1]^1))(integer_nthroot(10**(n-1), 4)), 1+integer_nthroot(10**n-1, 4)[0])) # Chai Wah Wu, Jun 26 2024
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Zhining Yang, Jun 22 2024
STATUS
approved