# Smallest positive integer

Let S(m) is the sum of the factorials of the digits of integer m. I try to find the smallest positive integer n with S(n)=111. My answer is 12334444. Is it right?

-
Yes, this looks right. – Rasmus Mar 19 '12 at 9:19
I'm not quite sure how to prove it, but I'm pretty sure since each factorial is an integer multiple of the previous, you can solve this by repeatedly finding the largest factorial less than S(n). – Mike Mar 19 '12 at 14:48
There can't be a digit greater than 4, and there can't be more than four 4s. Which reduces the number of possibilities. There must be lots of solutions made up of 0s and 1s. All the anagrams of a solution are also solutions, leading zeros aside. – Peter Phipps Mar 19 '12 at 17:53

for a from 1 to 9 do
for b from 0 to 9 do
for c from 0 to 9 do
for d from 0 to 9 do
for e from 0 to 9 do
for f from 0 to 9 do
for g from 0 to 9 do
for h from 0 to 9 do
if a!+b!+c!+d!+e!+f!+g!+h!=111 then
print(a,b,c,d,e,f,g,h);
end if;
end do;
end do;
end do;
end do;
end do;
end do;
end do;
end do;


Smallest solution is : $12334444$ .

-
Wow! Maple is pretty powerful – Jeremy Carlos Mar 19 '12 at 14:19
@JeremyCarlos: Pretty much any programming language could do that. – Najib Idrissi May 16 '12 at 17:12