You are viewing a single comment's thread. Return to all comments →
n=int(input())
a=[1,1,2,6,24,120,720,5040,40320,362880] sum1=0 for i in range(10,n): b=list(map(int,str(i))) c=sum(a[j] for j in b) if(c%i==0 ): sum1 +=i print(sum1)
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 →
n=int(input())
factorial from 0 to 9
a=[1,1,2,6,24,120,720,5040,40320,362880] sum1=0 for i in range(10,n): b=list(map(int,str(i))) c=sum(a[j] for j in b) if(c%i==0 ): sum1 +=i print(sum1)