

A135740


Maximal sum of decimal digits of a^b for 1 <= a,b <= n.


1



1, 4, 9, 13, 13, 27, 36, 37, 45, 45, 62, 64, 71, 97, 99, 99, 109, 117, 127, 136, 136, 148, 153, 163, 171, 197, 197, 202, 224, 224, 236, 236, 251, 256, 281, 281, 302, 302, 306, 306, 315, 352, 352, 355, 360, 385, 385, 396, 406, 406, 431, 432, 437, 441, 469, 469
(list;
graph;
refs;
listen;
history;
text;
internal format)



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

Table of n, a(n) for n=1..56.
Project Euler, Problem 56: Considering natural numbers of the form a^b, find the maximum digital sum.


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

Sequence in context: A125848 A225752 A066588 * A312870 A312871 A247881
Adjacent sequences: A135737 A135738 A135739 * A135741 A135742 A135743


KEYWORD

base,nonn


AUTHOR

M. F. Hasler, Nov 30 2007


EXTENSIONS

More terms from Stefan Steinerberger, Dec 22 2007


STATUS

approved



