Self-Factorial Number

Self-factorial number is the number where its digits' factorials summation is equal to the number itself. But there are only a few amount of them. For example;

$1=1!$

$2=2!$

$145= 1!+4!+5!$

So what is the fourth self-factorial number? How about fifth?

• Are we using base ten? – Ankoganit Dec 24 '16 at 13:47
• @Ankoganit of course :) – Oray Dec 24 '16 at 13:47

A self-factorial number can have no more than 7 digits. Proof: Suppose it has $n$ digits. Then the sum of the factorials of the digits is at most $$9! \cdot n = 362880n$$ whereas the number itself is at least $$10^{n-1}.$$ For $n \ge 8$, $10^{n-1} > 362880n$ so these two cannot be equal.

So it remains that we check all numbers with up to $7$ digits. A brute-force search checking $1$ to $9999999$ finds that the only solutions are

1, 2, 145, 40585.

• i like this one, thanks for showing that it is not possible to have more than 4 numbers. – Oray Dec 24 '16 at 16:17

Its

40585. They are factorians-A014080. And no there is no fifth. Reference

• lol I did not know it was defined :) – Oray Dec 24 '16 at 14:33

I wrote a Java program to find a solution by brute-force. I found

40585

as a fourth number.

The fifth number should have a ton of digits. I'm still searching.

EDIT: it looks like there is not a fifth one.

• It's a Java program. It'll take it some time to count to 5. – UTF-8 Dec 24 '16 at 18:36