Skip to content

Instantly share code, notes, and snippets.

@yuda110
Created August 17, 2017 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuda110/10e9859b26a5f3066f5673388d86517b to your computer and use it in GitHub Desktop.
Save yuda110/10e9859b26a5f3066f5673388d86517b to your computer and use it in GitHub Desktop.
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