0
$\begingroup$

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?

$\endgroup$
  • $\begingroup$ Is this what you mean? oeis.org/A014080 $\endgroup$ – Amzoti Oct 20 '13 at 20:41
  • $\begingroup$ Yeah that's what i mean. Wow what a good website too i bookmarked it i can definitely see this coming in handy thank you : ) $\endgroup$ – Achilles Oct 21 '13 at 13:17
  • $\begingroup$ Did you see the Mathematica code that is on that page? $\endgroup$ – Amzoti Oct 21 '13 at 13:22
  • $\begingroup$ yeah i saw it. Its more or less what Calle has said below. $\endgroup$ – Achilles Oct 21 '13 at 13:25
2
$\begingroup$

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}}
$\endgroup$
  • $\begingroup$ Yeah, that makes complete sense i don't know why i didn't think of that hahaha. Thanks a lot i appreciate i understand everything that's going on in the code to besides the "Reap" function you are using. I have never seen it before but i will look this function up in mathematica for further incite. I just hope that sooner or later i can start recognizing that there are alternate ways to solve a problem when i look at it. Thanks so much for the help its appreciated. I $\endgroup$ – Achilles Oct 21 '13 at 13:02
  • $\begingroup$ What is the purpose of the 2 at the end ? $\endgroup$ – Achilles Oct 21 '13 at 21:24
  • $\begingroup$ @Achilles Look up Part in the docuentation. Reap reurns a list; the first part is the result of the calculation as it would have been without Reap present. The second part is a list of valued that were "sown". $\endgroup$ – user3680 Oct 21 '13 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.