Problem

Source: Bulgarian Autumn Math Tournament 2024, 8.4

Tags: combinatorics, lattice points, Equilateral Triangle, function



Let $n$ be a positive integers. Equilateral triangle with sides of length $n$ is split into equilateral triangles with side lengths $1$, forming a triangular lattice. Call an equilateral triangle with vertices in the lattice "important". Let $p_k$ be the number of unordered pairs of vertices in the lattice which participate in exactly $k$ important triangles. Find (as a function of $n$) (a) $p_0+p_1+p_2$ (b) $p_1+2p_2$