# Closed Form for Heptagonal Pyramidal Numbers

## Theorem

The closed-form expression for the $n$th heptagonal pyramidal number is:

$Q_n = \dfrac {n \paren {n + 1} \paren {5 n - 2} } 6$

## Proof

 $\ds Q_n$ $=$ $\ds \sum_{k \mathop = 1}^n H_n$ Definition of Heptagonal Pyramidal Number $\ds$ $=$ $\ds \sum_{k \mathop = 1}^n \dfrac {k \paren {5 k - 3} } 2$ Closed Form for Heptagonal Numbers $\ds$ $=$ $\ds \dfrac 1 2 \paren {5 \sum_{k \mathop = 1}^n k^2 - 3 \sum_{k \mathop = 1}^n k}$ $\ds$ $=$ $\ds \dfrac 1 2 \paren {5 \frac {n \paren {n + 1} \paren {2 n + 1} } 6 - 3 \sum_{k \mathop = 1}^n k}$ Sum of Sequence of Squares $\ds$ $=$ $\ds \dfrac 1 2 \paren {5 \frac {n \paren {n + 1} \paren {2 n + 1} } 6 - 3 \dfrac {n \paren {n + 1} } 2}$ Closed Form for Triangular Numbers $\ds$ $=$ $\ds \dfrac 1 2 \paren {\frac {5 n \paren {n + 1} \paren {2 n + 1} - 9 n \paren {n + 1} } 6}$ $\ds$ $=$ $\ds \dfrac 1 2 \paren {\frac {n \paren {n + 1} \paren {5 \paren {2 n + 1} - 9} } 6}$ $\ds$ $=$ $\ds \dfrac 1 2 \paren {\frac {n \paren {n + 1} \paren {10 n + 5 - 9} } 6}$ $\ds$ $=$ $\ds \dfrac 1 2 \paren {\frac {n \paren {n + 1} \paren {10 n - 4} } 6}$ $\ds$ $=$ $\ds \frac {n \paren {n + 1} \paren {5 n - 2} } 6$

$\blacksquare$