In number theory, a factorion in a given number base ${\displaystyle b}$ is a natural number that equals the sum of the factorials of its digits.[1][2][3] The name factorion was coined by the author Clifford A. Pickover.[4]

Definition

Let ${\displaystyle n}$ be a natural number. For a base ${\displaystyle b>1}$, we define the sum of the factorials of the digits[5][6] of ${\displaystyle n}$, ${\displaystyle \operatorname {SFD} _{b}:\mathbb {N} \rightarrow \mathbb {N} }$, to be the following:

${\displaystyle \operatorname {SFD} _{b}(n)=\sum _{i=0}^{k-1}d_{i}!.}$

where ${\displaystyle k=\lfloor \log _{b}n\rfloor +1}$ is the number of digits in the number in base ${\displaystyle b}$, ${\displaystyle n!}$ is the factorial of ${\displaystyle n}$ and

${\displaystyle d_{i}={\frac {n{\bmod {b^{i+1))}-n{\bmod {b^{i)))){b^{i))))$

is the value of the ${\displaystyle i}$th digit of the number. A natural number ${\displaystyle n}$ is a ${\displaystyle b}$-factorion if it is a fixed point for ${\displaystyle \operatorname {SFD} _{b))$, i.e. if ${\displaystyle \operatorname {SFD} _{b}(n)=n}$.[7] ${\displaystyle 1}$ and ${\displaystyle 2}$ are fixed points for all bases ${\displaystyle b}$, and thus are trivial factorions for all ${\displaystyle b}$, and all other factorions are nontrivial factorions.

For example, the number 145 in base ${\displaystyle b=10}$ is a factorion because ${\displaystyle 145=1!+4!+5!}$.

For ${\displaystyle b=2}$, the sum of the factorials of the digits is simply the number of digits ${\displaystyle k}$ in the base 2 representation since ${\displaystyle 0!=1!=1}$.

A natural number ${\displaystyle n}$ is a sociable factorion if it is a periodic point for ${\displaystyle \operatorname {SFD} _{b))$, where ${\displaystyle \operatorname {SFD} _{b}^{k}(n)=n}$ for a positive integer ${\displaystyle k}$, and forms a cycle of period ${\displaystyle k}$. A factorion is a sociable factorion with ${\displaystyle k=1}$, and a amicable factorion is a sociable factorion with ${\displaystyle k=2}$.[8][9]

All natural numbers ${\displaystyle n}$ are preperiodic points for ${\displaystyle \operatorname {SFD} _{b))$, regardless of the base. This is because all natural numbers of base ${\displaystyle b}$ with ${\displaystyle k}$ digits satisfy ${\displaystyle b^{k-1}\leq n\leq (b-1)!(k)}$. However, when ${\displaystyle k\geq b}$, then ${\displaystyle b^{k-1}>(b-1)!(k)}$ for ${\displaystyle b>2}$, so any ${\displaystyle n}$ will satisfy ${\displaystyle n>\operatorname {SFD} _{b}(n)}$ until ${\displaystyle n. There are finitely many natural numbers less than ${\displaystyle b^{b))$, so the number is guaranteed to reach a periodic point or a fixed point less than ${\displaystyle b^{b))$, making it a preperiodic point. For ${\displaystyle b=2}$, the number of digits ${\displaystyle k\leq n}$ for any number, once again, making it a preperiodic point. This means also that there are a finite number of factorions and cycles for any given base ${\displaystyle b}$.

The number of iterations ${\displaystyle i}$ needed for ${\displaystyle \operatorname {SFD} _{b}^{i}(n)}$ to reach a fixed point is the ${\displaystyle \operatorname {SFD} _{b))$ function's persistence of ${\displaystyle n}$, and undefined if it never reaches a fixed point.

Factorions for SFDb

b = (k − 1)!

Let ${\displaystyle k}$ be a positive integer and the number base ${\displaystyle b=(k-1)!}$. Then:

• ${\displaystyle n_{1}=kb+1}$ is a factorion for ${\displaystyle \operatorname {SFD} _{b))$ for all ${\displaystyle k.}$
Proof

Let the digits of ${\displaystyle n_{1}=d_{1}b+d_{0))$ be ${\displaystyle d_{1}=k}$, and ${\displaystyle d_{0}=1.}$ Then

${\displaystyle \operatorname {SFD} _{b}(n_{1})=d_{1}!+d_{0}!}$
${\displaystyle =k!+1!}$
${\displaystyle =k(k-1)!+1}$
${\displaystyle =d_{1}b+d_{0))$
${\displaystyle =n_{1))$

Thus ${\displaystyle n_{1))$ is a factorion for ${\displaystyle F_{b))$ for all ${\displaystyle k}$.

• ${\displaystyle n_{2}=kb+2}$ is a factorion for ${\displaystyle \operatorname {SFD} _{b))$ for all ${\displaystyle k}$.
Proof

Let the digits of ${\displaystyle n_{2}=d_{1}b+d_{0))$ be ${\displaystyle d_{1}=k}$, and ${\displaystyle d_{0}=2}$. Then

${\displaystyle \operatorname {SFD} _{b}(n_{2})=d_{1}!+d_{0}!}$
${\displaystyle =k!+2!}$
${\displaystyle =k(k-1)!+2}$
${\displaystyle =d_{1}b+d_{0))$
${\displaystyle =n_{2))$

Thus ${\displaystyle n_{2))$ is a factorion for ${\displaystyle F_{b))$ for all ${\displaystyle k}$.

Factorions
${\displaystyle k}$ ${\displaystyle b}$ ${\displaystyle n_{1))$ ${\displaystyle n_{2))$
4 6 41 42
5 24 51 52
6 120 61 62
7 720 71 72

b = k! − k + 1

Let ${\displaystyle k}$ be a positive integer and the number base ${\displaystyle b=k!-k+1}$. Then:

• ${\displaystyle n_{1}=b+k}$ is a factorion for ${\displaystyle \operatorname {SFD} _{b))$ for all ${\displaystyle k}$.
Proof

Let the digits of ${\displaystyle n_{1}=d_{1}b+d_{0))$ be ${\displaystyle d_{1}=1}$, and ${\displaystyle d_{0}=k}$. Then

${\displaystyle \operatorname {SFD} _{b}(n_{1})=d_{1}!+d_{0}!}$
${\displaystyle =1!+k!}$
${\displaystyle =k!+1-k+k}$
${\displaystyle =1(k!-k+1)+k}$
${\displaystyle =d_{1}b+d_{0))$
${\displaystyle =n_{1))$

Thus ${\displaystyle n_{1))$ is a factorion for ${\displaystyle F_{b))$ for all ${\displaystyle k}$.

Factorions
${\displaystyle k}$ ${\displaystyle b}$ ${\displaystyle n_{1))$
3 4 13
4 21 14
5 116 15
6 715 16

Table of factorions and cycles of SFDb

All numbers are represented in base ${\displaystyle b}$.

Base ${\displaystyle b}$ Nontrivial factorion (${\displaystyle n\neq 1}$, ${\displaystyle n\neq 2}$)[10] Cycles
2 ${\displaystyle \varnothing }$ ${\displaystyle \varnothing }$
3 ${\displaystyle \varnothing }$ ${\displaystyle \varnothing }$
4 13 3 → 12 → 3
5 144 ${\displaystyle \varnothing }$
6 41, 42 ${\displaystyle \varnothing }$
7 ${\displaystyle \varnothing }$ 36 → 2055 → 465 → 2343 → 53 → 240 → 36
8 ${\displaystyle \varnothing }$

3 → 6 → 1320 → 12

175 → 12051 → 175

9 62558
10 145, 40585

871 → 45361 → 871[9]

872 → 45362 → 872[8]

Programming example

The example below implements the sum of the factorials of the digits described in the definition above to search for factorions and cycles in Python.

def factorial(x: int) -> int:
total = 1
for i in range(0, x):
total = total * (i + 1)

def sfd(x: int, b: int) -> int:
"""Sum of the factorials of the digits."""
total = 0
while x > 0:
total = total + factorial(x % b)
x = x // b

def sfd_cycle(x: int, b: int) -> List[int]:
seen = []
while x not in seen:
seen.append(x)
x = sfd(x, b)
cycle = []
while x not in cycle:
cycle.append(x)
x = sfd(x, b)
return cycle