# Five Ramanujan-Nagell Numbers

## Theorem

There exist exactly $5$ Ramanujan-Nagell numbers: positive integers of the form $2^m - 1$ which are triangular:

$0, 1, 3, 15, 4095$

## Proof

Consider the numbers of the form $2^m - 1$ which are triangular:

 $\displaystyle 2^m - 1$ $=$ $\displaystyle \frac {r \left({r + 1}\right)} 2$ Closed Form for Triangular Numbers $\displaystyle \iff \ \$ $\displaystyle 8 \left({2^m - 1}\right)$ $=$ $\displaystyle 4 r \left({r + 1}\right)$ $\displaystyle \iff \ \$ $\displaystyle 2^{m + 3} - 8$ $=$ $\displaystyle 4 r^2 + 4 r$ $\text {(1)}: \quad$ $\displaystyle \iff \ \$ $\displaystyle 2^{m + 3} - 7$ $=$ $\displaystyle 4 r^2 + 4 r + 1$ $\displaystyle$ $=$ $\displaystyle \left({2 r + 1}\right)^2$

Let:

$n = m - 3$
$x = 2 r + 1$

and it can be seen that $(1)$ is equivalent to:

$x^2 + 7 = 2^n$
$x = 1, 3, 5, 11, 181$

Setting $r = \dfrac {x - 1} 2$ it is seen that the corresponding triangular numbers are:

$\dfrac{\left({x - 1}\right) \left({x + 1}\right)} 8$

Thus the corresponding Ramanujan-Nagell numbers are:

$0, 1, 3, 15, 4095$

$\blacksquare$