# Tetrahedral number

A tetrahedral number, or triangular pyramidal number, is a figurate number that represents a pyramid with a triangular base and three sides, called a tetrahedron. The nth tetrahedral number, Te$_n$, is the sum of the first n triangular numbers, that is,
    $Te_{n}=\sum _{k=1}^{n}T_{k}=\sum _{k=1}^{n}{\frac {k(k+1)}{2}}=\sum _{k=1}^{n}\left(\sum _{i=1}^{k}i\right)$
The tetrahedral numbers are:
    1, 4, 10, 20, 35, 56, 84, 120, 165, 220, ... (sequence A000292 in the OEIS)

## Formula

The formula for the nth tetrahedral number is represented by the 3rd rising factorial of n divided by the factorial of 3:
    $Te_{n}=\sum _{k=1}^{n}T_{k}=\sum _{k=1}^{n}{\frac {k(k+1)}{2}}=\sum _{k=1}^{n}\left(\sum _{i=1}^{k}i\right)={\frac {n(n+1)(n+2)}{6}}={\frac {n^{\overline {3}}}{3!}}$
The tetrahedral numbers can also be represented as binomial coefficients:
    $Te_{n}={\binom {n+2}{3}}.$
Tetrahedral numbers can therefore be found in the fourth position either from left or right in Pascal's triangle.

### Proofs of formula

This proof uses the fact that the nth triangular number is given by
    $T_{n}={\frac {n(n+1)}{2}}.$
It proceeds by induction.

#### Base case

    $Te_{1}=1={\frac {1\cdot 2\cdot 3}{6}}.$

#### Inductive step

    ${\begin{aligned}Te_{n+1}\quad &=Te_{n}+T_{n+1}\\&={\frac {n(n+1)(n+2)}{6}}+{\frac {(n+1)(n+2)}{2}}\\&=(n+1)(n+2)\left({\frac {n}{6}}+{\frac {1}{2}}\right)\\&={\frac {(n+1)(n+2)(n+3)}{6}}.\end{aligned}}$
The formula can also be proved by Gosper's algorithm.

### Recursive relation

Tetrahedral and triangular numbers are related through the recursive formulas
    ${\begin{aligned}&Te_{n}=Te_{n-1}+T_{n}&(1)\\&T_{n}=T_{n-1}+n&(2)\end{aligned}}$
The equation $(1)$ becomes
    ${\begin{aligned}&Te_{n}=Te_{n-1}+T_{n-1}+n\end{aligned}}$
Substituting $n-1$ for $n$ in equation $(1)$
    ${\begin{aligned}&Te_{n-1}=Te_{n-2}+T_{n-1}\end{aligned}}$
Thus, the $n$th tetrahedral number satisfies the following recursive equation
    ${\begin{aligned}&Te_{n}=2Te_{n-1}-Te_{n-2}+n\end{aligned}}$

## Generalization

The pattern found for triangular numbers $\sum _{n_{1}=1}^{n_{2}}n_{1}={\binom {n_{2}+1}{2}}$ and for tetrahedral numbers $\sum _{n_{2}=1}^{n_{3}}\sum _{n_{1}=1}^{n_{2}}n_{1}={\binom {n_{3}+2}{3}}$ can be generalized. This leads to the formula: $\sum _{n_{k-1}=1}^{n_{k}}\sum _{n_{k-2}=1}^{n_{k-1}}\ldots \sum _{n_{2}=1}^{n_{3}}\sum _{n_{1}=1}^{n_{2}}n_{1}={\binom {n_{k}+k-1}{k}}$

## Geometric interpretation

Tetrahedral numbers can be modelled by stacking spheres. For example, the fifth tetrahedral number (Te$_5$ = 35) can be modelled with 35 billiard balls and the standard triangular billiards ball frame that holds 15 balls in place. Then 10 more balls are stacked on top of those, then another 6, then another three and one ball at the top completes the tetrahedron.
When order-n tetrahedra built from Te$_n$ spheres are used as a unit, it can be shown that a space tiling with such units can achieve a densest sphere packing as long as n ≤ 4.

## Tetrahedral roots and tests for tetrahedral numbers

By analogy with the cube root of x, one can define the (real) tetrahedral root of x as the number n such that Te$_n$ = x: $n={\sqrt[{3}]{3x+{\sqrt {9{x^{2}}-{\frac {1}{27}}}}}}+{\sqrt[{3}]{3x-{\sqrt {9{x^{2}}-{\frac {1}{27}}}}}}-1$
which follows from Cardano's formula. Equivalently, if the real tetrahedral root n of x is an integer, x is the nth tetrahedral number.

## Properties

    Te$_n$ + Te$_{n−1}$ = 1$^2$ + 2$^2$ + 3$^2$ ... + n$^2$, the square pyramidal numbers.
    Te$_{2n+1}$ = 1$^2$ + 3$^2$ ... + (2n+1)$^2$, sum of odd squares.
    Te$_{2n}$ = 2$^2$ + 4$^2$ ... + (2n)$^2$  , sum of even squares.
* A. J. Meyl proved in 1878 that only three tetrahedral numbers are also perfect squares, namely:
    Te$_1$ =   1$^2$ =     1
    Te$_2$ =   2$^2$ =     4
    Te$_{48}$ = 140$^2$ = 19600.
* Sir Frederick Pollock conjectured that every positive integer is the sum of at most 5 tetrahedral numbers: see Pollock tetrahedral numbers conjecture.
* The only tetrahedral number that is also a square pyramidal number is 1 (Beukers, 1988), and the only tetrahedral number that is also a perfect cube is 1.
* The infinite sum of tetrahedral numbers' reciprocals is ⁠3/2⁠, which can be derived using telescoping series:
    $\sum _{n=1}^{\infty }{\frac {6}{n(n+1)(n+2)}}={\frac {3}{2}}.$
* The parity of tetrahedral numbers follows the repeating pattern odd-even-even-even.
* An observation of tetrahedral numbers:
    Te$_5$ = Te$_4$ + Te$_3$ + Te$_2$ + Te$_1$
* Numbers that are both triangular and tetrahedral must satisfy the binomial coefficient equation:
    $T_{n}={\binom {n+1}{2}}={\binom {m+2}{3}}=Te_{m}.$
    The only numbers that are both tetrahedral and triangular numbers are (sequence A027568 in the OEIS):
       Te$_1$ = T$_1$ =    1
       Te$_3$ = T$_4$ =   10
       Te$_8$ = T$_{15}$ =  120
       Te$_{20}$ = T$_{55}$ = 1540
       Te$_{34}$ = T$_{119}$ = 7140
* Te$_n$ is the sum of all products p × q where (p, q) are ordered pairs and p + q = n + 1
* Te$_n$ is the number of (n + 2)-bit numbers that contain two runs of 1's in their binary expansion.
* The largest tetrahedral number of the form $2^{a}+3^{b}+1$ for some integers $a$ and $b$ is 8436.

## Popular culture

Te$_{12}$ = 364 is the total number of gifts "my true love sent to me" during the course of all 12 verses of the carol, "The Twelve Days of Christmas". The cumulative total number of gifts after each verse is also Te$_n$ for verse n.
The number of possible KeyForge three-house combinations is also a tetrahedral number, Te$_{n−2}$ where n is the number of houses.