OFFSET
1,2
COMMENTS
Clearly a(n) <= a(n+1). For what values of n do we have equality? Is there an explicit formula for a(n)?
LINKS
EXAMPLE
a(3)=9=2+7 is the digit sum of 3^2 and 3^3=27, all other a^b with a,b <= 3 have smaller digit sum.
a(4)=13=2+5+6 is the digit sum of 4^4=256, all other a^b with a,b <= 4 have smaller digit sum.
a(5)=13 since also for a,b <= 5 there is no higher digit sum (but the same is obtained for 5^4=625).
MATHEMATICA
a = {1}; For[n = 2, n < 100, n++, r = a[[ -1]]; For[j = 1, j < n + 1, j++, If[Max[Plus @@ IntegerDigits[n^j], Plus @@ IntegerDigits[j^n]] > r, r = Max[Plus @@ IntegerDigits[n^j], Plus @@ IntegerDigits[j^n]]]]; AppendTo[a, r]]; a (* Stefan Steinerberger, Dec 22 2007 *)
PROG
(PARI) digitsum(n, s)=n=[n]; while(n, n=divrem(n[1], 10); s+=n[2]); s A135740(n)=vecmax(matrix(n, n, i, j, digitsum(i^j)))
CROSSREFS
KEYWORD
base,nonn
AUTHOR
M. F. Hasler, Nov 30 2007
EXTENSIONS
More terms from Stefan Steinerberger, Dec 22 2007
STATUS
approved