# Factoriangular number

In number theory, a factoriangular number is an integer formed by adding a factorial and a triangular number with the same index. The name is a portmanteau of "factorial" and "triangular."

## Definition

For $n\geq 1$, the $n$th factoriangular number, denoted $\operatorname {Ft} _{n}$, is defined as the sum of the $n$th factorial and the $n$th triangular number:
    $\operatorname {Ft} _{n}=n!+T_{n}=n!+{\frac {n(n+1)}{2}}$.
The first few factoriangular numbers are:
| $n$ | $n!$ | $T_{n}$ | $\operatorname {Ft} _{n}=n!+T_{n}$ |
| 1 | 1 | 1 | 2 |
| 2 | 2 | 3 | 5 |
| 3 | 6 | 6 | 12 |
| 4 | 24 | 10 | 34 |
| 5 | 120 | 15 | 135 |
| 6 | 720 | 21 | 741 |
| 7 | 5,040 | 28 | 5,068 |
| 8 | 40,320 | 36 | 40,356 |
| 9 | 362,880 | 45 | 362,925 |
| 10 | 3,628,800 | 55 | 3,628,855 |
These numbers form the integer sequence A101292 in the Online Encyclopedia of Integer Sequences (OEIS).

## Properties
### Recurrence relations

Factoriangular numbers satisfy several recurrence relations. For $n\geq 1$,
    $\operatorname {Ft} _{n+1}=(n+1)\left(\operatorname {Ft} _{n}-{\frac {n^{2}-2}{2}}\right)$
And for $n\geq 2$,
    $\operatorname {Ft} _{n}=n\left(\operatorname {Ft} _{n-1}-{\frac {n^{2}-2n-1}{2}}\right)$
These are linear non-homogeneous recurrence relations with variable coefficients of order 1.

### Generating functions

The exponential generating function $E(x)=\sum _{n=0}^{\infty }\operatorname {Ft} _{n}{\tfrac {x^{n}}{n!}}$ for factoriangular numbers is (for $-1<x<1$)
    $E(x)={\frac {2+(2-5x^{2}+2x^{3}+x^{4})e^{x}}{2(1-x)^{2}}}$
If the sequence is extended to include $\operatorname {Ft} _{0}=1$, then the exponential generating function becomes
    $E(x)={\frac {2+(2x-x^{2}-x^{3})e^{x}}{2(1-x)}}$.

### Representations as sums of triangular numbers

Factoriangular numbers can sometimes be expressed as sums of two triangular numbers:
* $\operatorname {Ft} _{n}=2T_{n}$ if and only if $n=1$ or $n=3$.
* $\operatorname {Ft} _{n}=T_{x}+T_{n}$ if and only if $8n!+1$ is a perfect square. For $n\neq x$, the only known solution is $(\operatorname {Ft} _{5},T_{15})=(135,120)$, giving $\operatorname {Ft} _{5}=T_{5}+T_{15}$.
* $\operatorname {Ft} _{n}=T_{x}+T_{y}$ if and only if $8\operatorname {Ft} _{n}+2$ is a sum of two squares.

### Representations as sums of squares

Some factoriangular numbers can be expressed as the sum of two squares. For $n\leq 20$, the factoriangular numbers that can be written as $a^{2}+b^{2}$ for some integers $a$ and $b$ include:
* $\operatorname {Ft} _{1}=2=1^{2}+1^{2}$
* $\operatorname {Ft} _{2}=5=1^{2}+2^{2}$
* $\operatorname {Ft} _{4}=34=3^{2}+5^{2}$
* $\operatorname {Ft} _{9}=362,925=195^{2}+570^{2}$
This result is related to the sum of two squares theorem, which states that a positive integer can be expressed as a sum of two squares if and only if its prime factorization contains no prime factor of the form $4k+3$ raised to an odd power.

### Fibonacci factoriangular numbers

A Fibonacci factoriangular number is a number that is both a Fibonacci number and a factoriangular number. There are exactly three such numbers:
* $\operatorname {Ft} _{1}=2=F_{3}$
* $\operatorname {Ft} _{2}=5=F_{5}$
* $\operatorname {Ft} _{4}=34=F_{9}$
This result was conjectured by Romer Castillo and later proved by Ruiz and Luca.

### Pell factoriangular numbers

A Pell factoriangular number is a number that is both a Pell number and a factoriangular number. Luca and Gómez-Ruiz proved that there are exactly three such numbers: $\operatorname {Ft} _{1}=2$, $\operatorname {Ft} _{2}=5$, and $\operatorname {Ft} _{3}=12$.

### Catalan factoriangular numbers

A Catalan factoriangular number is a number that is both a Catalan number and a factoriangular number.

## Generalizations

The concept of factoriangular numbers can be generalized to $(n,k)$-factoriangular numbers, defined as $\operatorname {Ft} _{n,k}=n!+T_{k}$ where $n$ and $k$ are positive integers. The original factoriangular numbers correspond to the case where $n=k$. This generalization gives rise to factoriangular triangles, which are Pascal-like triangular arrays of numbers. Two such triangles can be formed:
* A triangle with entries $\operatorname {Ft} _{n,k}$ where $k\leq n$, yielding the sequence: 2, 3, 5, 7, 9, 12, 25, 27, 30, 34, ...
* A triangle with entries $\operatorname {Ft} _{n,k}$ where $k\geq n$, yielding the sequence: 2, 4, 5, 7, 8, 12, 11, 12, 16, 34, ...
In both cases, the diagonal entries (where $n=k$) correspond to the original factoriangular numbers.