this is the question: Write a python code to find all the integers less than 50,000 that equal to the sum of factorials of their digits. As an example: the number 7666 6= 7! + 6! + 6! + 6! but 145=1!+4!+5!
note: im not allowed to use any specific factorial function.
my solution:
import math
from numpy import *
for i in range(5):
for j in range(10):
for k in range(10):
for l in range(10):
for m in range(10):
x=1*m+10*l+100*k+1000*j+10000*i
def fact(m):
fact=1
for i in range(1,m+1):
fact=fact*i
return fact
y=fact(i)+fact(j)+fact(k)+fact(l)+fact(m)
if x==y :
print(x)