Talk:Factorions

From Rosetta Code

Limit of 1499999 in base 10

The following was removed from the wikipedia page in September 2019, on the grounds "described above for arbitrary base b".
Since I rather strongly disagree on that last point, I have replicated the original/deleted text here:

Upper bound (in base 10)
If n is a natural number of d digits that is a factorion, then 10d − 1 ≤ n ≤ 9!d. This fails to hold for d ≥ 8 thus n has at most seven digits, and the first upper bound is 9,999,999. But the maximum sum of factorials of digits for a seven-digit number is 9!*7 = 2,540,160 establishing the second upper bound. Going further, since no number bigger than 2540160 is possible, the first digit of a seven-digit number can be at most 2. Thus, only six positions can range up until 9 and 2!+6*9!= 2177282 becomes a third upper bound. This implies, if n is a seven-digit number, either the second digit is 0 or 1 or the first digit is 1. If the first digit is 2 and thus the second digit is 0 or 1, the numbers are limited by 2!+1!+5*9! = 1814403 - a contradiction to the first digit being 2. Thus, a seven-digit number can be at most 1999999, establishing our fourth upper bound.
All factorials of digits at least 5 have the factors 5 and 2 and thus end on 0. Let 1abcdef denote our seven-digit number. If all digits a-f are all at least 5, the sum of the factorials - which is supposed to be equal to 1abcdef - will end on 1 (coming from the 1! in the beginning). This is a contradiction to the assumption that f is at least 5. Thus, at least one of the digits a-f can be at most 4, which establishes 1!+4!+5*9!=1814425 as fifth upper bound. Assuming n is a seven-digit number, the second digit is at most 8. There are two cases: If a is at least 5, by the same argument as above one of the remaining digits b-f has to be at most 4. This implies an upper bound (since a is at most 8) of 1!+8!+4!+4*9!= 1491865, a contradiction to a being at least 5. Thus, a is at most 4 and the sixth upper bound is 1499999.
A computer can check all numbers from 40585 to 1499999, verifying that 40585 is the largest factorion in base 10.

Quite incorrectly, almost all entries (bar Pascal, Perl[2], Phix[2], Sidef) also use that limit for bases 9, 11, and 12... --Pete Lomax (talk) 22:42, 15 January 2022 (UTC)