← Complete problem index

PROJECT EULER · #0577

Counting Hexagons

Statement only · SolvedOriginal problem ↗

An equilateral triangle with integer side length n3 is divided into n2 equilateral triangles with side length 1 as shown in the diagram below.
The vertices of these triangles constitute a triangular lattice with (n+1)(n+2)2 lattice points.

Let H(n) be the number of all regular hexagons that can be found by connecting 6 of these points.

0577_counting_hexagons.png

For example, H(3)=1, H(6)=12 and H(20)=966.

Find n=312345H(n).

Write-up coming later

The complete problem is available here. An approach, code, and answer will be added later.