Let $n$ be a positive integer. A regular hexagon with side length $n$ is divided into equilateral triangles with side length 1 by lines parallel to its sides.
Find the number of regular hexagons all of whose vertices are among the vertices of the equilateral triangles.
By a lattice hexagon we will mean a regular hexagon whose sides run along edges of the lattice. Given any regular hexagon $H$, we construct a lattice hexagon whose edges pass through the vertices of $H$, as shown in the figure, which we will call the enveloping lattice hexagon of $H$. Given a lattice hexagon $G$ of side length $m$, the number of regular hexagons whose enveloping lattice hexagon is $G$ is exactly $m$.

Yet also there are precisely $3(n-m)(n-m+1)+1$ lattice hexagons of side length $m$ in our lattice: they are those with centres lying at most $n-m$ steps from the centre of the lattice. In particular, the total number of regular hexagons equals
![](https://cdn.mathpix.com/cropped/2024_12_10_86b1467c9ecfa953dbf8g-5.jpg?height=461&width=513&top_left_y=1437&top_left_x=1314)
$N=\sum_{m=1}^{n}(3(n-m)(n-m+1)+1) m=\left(3 n^{2}+3 n\right) \sum_{m=1}^{n} m-3(2 m+1) \sum_{m=1}^{n} m^{2}+3 \sum_{m=1}^{n} m^{3}$.
Since $\sum_{m=1}^{n} m=\frac{n(n+1)}{2}, \sum_{m=1}^{n} m^{2}=\frac{n(n+1)(2 n+1)}{6}$ and $\sum_{m=1}^{n} m^{3}=\left(\frac{n(n+1)}{2}\right)^{2}$ it is easily checked that $N=\left(\frac{n(n+1)}{2}\right)^{2}$.