Created
July 23, 2021 06:01
-
-
Save igorvanloo/d4db549fcad59b50e579dfc43d3f2a3c to your computer and use it in GitHub Desktop.
Problem 34
This file contains hidden or 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 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