Created
August 17, 2017 04:54
-
-
Save yuda110/10e9859b26a5f3066f5673388d86517b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc_googol(a_to, b_to): | |
max_sum = 0 | |
for a in range(1, a_to): | |
for b in range(1, b_to): | |
num = a**b | |
sum_of_digits = sum(int(x) for x in str(num)) | |
if sum_of_digits > max_sum: | |
max_sum = sum_of_digits | |
return max_sum | |
if __name__ == '__main__': | |
print(calc_googol(101, 101)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment