Skip to content

Instantly share code, notes, and snippets.

@igorvanloo
Created July 23, 2021 06:01
Show Gist options
  • Save igorvanloo/d4db549fcad59b50e579dfc43d3f2a3c to your computer and use it in GitHub Desktop.
Save igorvanloo/d4db549fcad59b50e579dfc43d3f2a3c to your computer and use it in GitHub Desktop.
Problem 34
def sum_digits_mod(x):
facts = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880]
totalsum = 0
while x != 0:
totalsum += facts[x % 10]
x = x // 10
return totalsum
def compute():
overalltotal = 0
for x in range(3,2903040):
if sum_digits_mod(x) == x:
overalltotal += x
return (overalltotal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment