You are viewing a single comment's thread. Return to all comments →
python3 code
import math n = int(input()) if n < 19: sum_ = 0 elif n < 21: sum_ = 19 else: sum_ = 19 dic = dict() for j in range(0, 10): dic[j] = math.factorial(j) for i in range(21, n): tmp_sum = 0 odd_sum = 0 for s in str(i): if s in ('0', '1'): odd_sum += 1 if odd_sum % 2 == 1 and i % 2 == 0: continue for s in str(i): tmp_sum += dic[int(s)] if tmp_sum % i == 0: sum_ += i print(sum_)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #34: Digit factorials
You are viewing a single comment's thread. Return to all comments →
python3 code