Write a Mathematica program to find the four known factorions

159 Views Asked by At

so i have come up with code that will find the four factorion numbers. I have a bunch of ideas of how it needs to be done theoretically but its still not quite clicking for me not too mention i am new to mathematica so the syntax is a bit confusing. So can anyone show me the proper code with brief explanations?

1

There are 1 best solutions below

3
On BEST ANSWER

Actually, the numbers are so small we can do this very quickly by just testing for each combination below a certain threshold:

Reap[If[Total@Factorial[IntegerDigits[#]] == #, Sow@#] & /@ Range[50000]][[2]]

Which returns

{{1, 2, 145, 40585}}