Triads

April 2020 : Puzzle

Consider an equilateral triangular grid of dots with N rows, such as the one presented here (with N = 22). A “triad” is a set of 3 dots where each dot in the triad borders the other two. The top two rows the triangular grid form a triad; all triads are (rotations of) precisely this shape.

For some values of N, it is possible to separate the triangular grid into disjoint triads such that every dot is a part of one triad. For example, it is obviously possible when N=2, but not when N=3 or N=4.

What is the sum of all values of N < 40 for which it is possible?