-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp056.py
19 lines (16 loc) · 1.06 KB
/
p056.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
################################################################################
# P56: Powerful digit sum #
################################################################################
# #
# Considering natural numbers of the form, a^b, where a, b < 100, what is the #
# maximum digit sum? #
# #
################################################################################
# Problem found at projecteuler.net #
# Author: ncfgrill #
################################################################################
max_sum = 0
for a in range(2, 100):
for b in range(2, 100):
max_sum = max(max_sum, sum(int(l) for l in str(a ** b)))
print('Maximum digit sum:', max_sum)