Difference between revisions of "Factorions"

From Fōrmulæ wiki
Jump to: navigation, search
(Creation of page)
(No difference)

Latest revision as of 12:49, 13 August 2019

This page is the answer to the task Factorions in the Rosetta Code.

Description (from Rosetta Code)


A factorion is a natural number that equals the sum of the factorials of its digits. For example 145 is a factorion in base 10 because:

   1! + 4! + 5! = 1 + 24 + 120 = 145.


It can be shown (see Wikipedia article below) that no factorion in base 10 can exceed 1,499,999.

Write a program in your language to demonstrate, by calculating and printing out the factorions, that:

1. There are 4 factorions in base 10.

2. There are 3 factorions in base 9, 5 factorions in base 11 but only 2 factorions in base 12 up to the same upper bound as for base 10.

See also


Testing whether a number is a factorion

The following function tests whether a number is a factorion in a given base:




Calculating a list of factorions

The following function returns a list o factorions in a given base, up to a limit:




Calculating list for different bases

The following calculates factorion lists from bases 9 to 12, with a limit of 1'499,999