This site is supported by donations to The OEIS Foundation.

# Triangular numbers

The ${\displaystyle \scriptstyle n\,}$th triangular number is defined as the sum of the first ${\displaystyle \scriptstyle n\,}$ positive integers

${\displaystyle t_{n}:=\sum _{i=1}^{n}i={\frac {n(n+1)}{2}}={\binom {n+1}{2}},\quad n\geq 0,\,}$

where ${\displaystyle \scriptstyle t_{0}\,=\,0\,}$ since it is the empty sum of positive integers (giving the additive identity, i.e. 0), and ${\displaystyle \scriptstyle {\binom {n}{k}}\,}$ is a binomial coefficient. The ${\displaystyle \scriptstyle n\,}$th triangular number is thus one half of the ${\displaystyle \scriptstyle n\,}$th pronic number (or oblong number).

A000217 Triangular numbers: a(n) = C(n+1,2) = n(n+1)/2 = 0+1+2+...+n, n ≥ 0.

{0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, , 561, 595, 630, 666, 703, 741, 780, ...}

This was proved by Euler, by the following trick:

    1,   2,   3, ..., n-2, n-1,   n
+  n, n-1, n-2, ...,   3,   2,   1
----------------------------------
n+1, n+1, n+1, ..., n+1, n+1, n+1

thus t_n = n*(n+1)/2.


That proof is sometimes also credited to Carl Friedrich Gauß:

Theorem. The sum of the first ${\displaystyle \scriptstyle n\,}$ positive integers (the ${\displaystyle \scriptstyle n\,}$th triangular number ${\displaystyle \scriptstyle t_{n}\,}$) is equal to ${\displaystyle \scriptstyle {\frac {n^{2}+n}{2}}\,}$.

Proof. (Gauß) We can write ${\displaystyle \scriptstyle t_{n}\,=\,1+2+3+\ldots +(n-1)+n\,}$. Since addition is commutative, we can also write ${\displaystyle \scriptstyle t_{n}\,=\,n+(n-1)+\ldots +3+2+1\,}$. If we add up these expressions term by term, left to right, we obtain ${\displaystyle \scriptstyle 2t_{n}\,=\,(1+n)+(2+(n-1))+\ldots +((n-1)+2)+(n+1)\,}$. Each of these parenthesized addends works out to ${\displaystyle \scriptstyle n+1\,}$ and there are ${\displaystyle \scriptstyle n\,}$ of these addends. Therefore, ${\displaystyle \scriptstyle 2t_{n}\,=\,n(n+1)\,=\,n^{2}+n\,}$ and dividing both sides by 2 we get ${\displaystyle \scriptstyle t_{n}\,=\,{\frac {n^{2}+n}{2}}\,}$ as specified by the theorem. □ [1]

## Relations

${\displaystyle t_{n}-t_{n-1}=n,\quad n\geq 1.\,}$
${\displaystyle t_{n}-2t_{n-1}+t_{n-2}=1,\quad n\geq 2.\,}$
${\displaystyle t_{n}+t_{n-1}=n^{2},\quad n\geq 1.\,}$
${\displaystyle {\frac {t_{n}}{t_{n-1}}}={\frac {n+1}{n-1}},\quad n\geq 1.\,}$

### Relations involving binomial coefficients

Charles Marion <charliemath@optonline.net> suggested the following two relations:

${\displaystyle \sum _{k=0}^{m}(-1)^{k}{\binom {m}{m-k}}t_{n-k}=0,\ n\geq m>2,\,}$
${\displaystyle \sum _{k=0}^{m}{\binom {m}{m-k}}t_{n-k}=\sum _{k=0}^{m-1}{\binom {m-1}{m-k-1}}(n-k)^{2},\ n\geq m>0,\,}$

where ${\displaystyle \scriptstyle m\,=\,1\,}$ gives ${\displaystyle \scriptstyle t_{n}+t_{n-1}\,=\,n^{2}.\,}$

## Sum of reciprocals

The partial sums of the reciprocals of the triangular numbers gives (easily proved by induction)

${\displaystyle \sum _{i=1}^{n}{\frac {1}{t_{i}}}={\frac {n^{2}}{t_{n}}}.\,}$

The sum of the reciprocals of the triangular numbers converges to 2

${\displaystyle \lim _{n\to \infty }\sum _{i=1}^{n}{\frac {1}{t_{n}}}=\lim _{n\to \infty }{\frac {n^{2}}{t_{n}}}=\lim _{n\to \infty }{\frac {2n^{2}}{n(n+1)}}=2.\,}$

## Representations of natural numbers as a sum of three triangular numbers

Every natural number may be represented, in at least one way, as a sum of three triangular numbers (with up to three nonzero triangular numbers).

Representations of ${\displaystyle n}$ as a sum of three triangular numbers
${\displaystyle n\,}$ Representations Number of
representations
0 { {0, 0, 0} } 1
1 { {1, 0, 0} } 1
2 { {1, 1, 0} } 1
3 { {3, 0, 0}, {1, 1, 1} } 2
4 { {3, 1, 0} } 1
5 { {3, 1, 1} } 1
6 { {6, 0, 0}, {3, 3, 0} } 2
7 { {6, 1, 0}, {3, 3, 1} } 2
8 { {6, 1, 1} } 1
9 { {6, 3, 0}, {3, 3, 3} } 2
10 { {10, 0, 0}, {6, 3, 1} } 2
11 { {10, 1, 0} } 1
12 { {10, 1, 1}, {6, 6, 0}, {6, 3, 3} } 3
13 { {10, 3, 0}, {6, 6, 1} } 2
14 { {10, 3, 1} } 1
15 { {15, 0, 0}, {6, 6, 3} } 2
16 { {15, 1, 0}, {10, 6, 0}, {10, 3, 3} } 3

A002636 Number of representations of ${\displaystyle n}$ as a sum of up to three nonzero triangular numbers.

{1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 3, 2, 1, 2, 3, 2, 2, 2, 1, 4, 3, 2, 2, 2, 2, 3, 3, 1, 4, 4, 2, 2, 3, 2, 3, 4, 2, 3, 3, 2, 4, 3, 2, 4, 4, 2, 4, 4, 1, 4, 5, 1, 2, 3, 4, 6, 4, 3, 2, 5, 2, 3, 3, 3, 6, 5, 2, 2, 5, 3, 5, 4, 2, 4, 5, 3, 4, ...}

## Even perfect numbers

Every even perfect number is a triangular number, since they are a subset of

${\displaystyle 2^{n-1}\cdot (2^{n}-1)={\frac {(2^{n}-1)2^{n}}{2}}=t_{2^{n}-1},\,}$

where ${\displaystyle \scriptstyle 2^{n}-1\,}$ is [necessarily, but not sufficiently] a Mersenne prime.

Every even perfect number is also an hexagonal number, since they are a subset of

${\displaystyle 2^{n-1}\cdot (2^{n}-1)=2^{n-1}\cdot (2\cdot 2^{n-1}-1)=h_{2^{n-1}},\,}$

where ${\displaystyle \scriptstyle 2^{n}-1\,}$ is [necessarily, but not sufficiently] a Mersenne prime.