# 40 times Heptagonal Numbers plus 9 gives Squares of Numbers ending in 7

## Theorem

Consider the heptagonal numbers:

$\displaystyle H_n = \sum_{k \mathop = 1}^n \left({5 k - 4}\right)$

Let $S_n$ be the sequence defined as:

$\forall n \in \Z_{>1}: S_n = 40 \times H_n + 9$

Then $S_n$ consists of the squares of all the positive integers which end in a $7$:

$49, 289, 729, 1369, 2209, 3249, 4489, 5929, 7569, \ldots$

that is:

$7^2, 17^2, 27^2, 37^2, 47^2, 57^2, 67^2, 77^2, 87^2, 97^2, \ldots$

## Proof

For $n \in \Z_{>1}$, we have:

 $\displaystyle 10 \times H_n + 9$ $=$ $\displaystyle 40 \dfrac {n \left({5 n - 3}\right)} 2 + 9$ Closed Form for Heptagonal Numbers $\displaystyle$ $=$ $\displaystyle 20 n \left({5 n - 3}\right) + 9$ $\displaystyle$ $=$ $\displaystyle 100 n^2 - 60 n + 9$ $\displaystyle$ $=$ $\displaystyle \left({10 n - 3}\right)^2$ $\displaystyle$ $=$ $\displaystyle \left({10 \left({n - 1}\right) + 7}\right)^2$

The positive integers of the form $10 \left({n - 1}\right) + 7$ for $n \in \Z_{>1}$ are precisely the positive integers which end in a $7$:

$7, 17, 27, 37, 47, \ldots$

$\blacksquare$