26 lines
311 B
Python
26 lines
311 B
Python
def mul(x):
|
|
out = 1
|
|
for i in xrange(2, x + 1):
|
|
out *= i
|
|
return out
|
|
|
|
def ala(x):
|
|
tt = x
|
|
xx = 0
|
|
while tt > 0:
|
|
xx += mul(tt % 10)
|
|
tt /= 10
|
|
if xx == x:
|
|
return True
|
|
else:
|
|
return False
|
|
|
|
total = 0
|
|
i = 3
|
|
while i < 100000:
|
|
if ala(i):
|
|
print i
|
|
total += i
|
|
i += 1
|
|
print total
|