Figurate and Polygonal Numbers
Figurate numbers count the dots needed to build a shape — a triangle, square, or pentagon — one layer bigger each time, giving simple closed-form formulas that a surprising number of interview counting puzzles reduce to.
Figurate numbers count how many dots it takes to arrange a shape of a given size, growing that shape one ring or row at a time. The most familiar is the triangular numbers — 1, 3, 6, 10, 15 — formed by stacking rows of 1, 2, 3, 4, 5 dots into a triangle, giving the formula . Square numbers — 1, 4, 9, 16 — are just , formed by an grid of dots. More generally, the polygonal number for a -sided regular polygon of "size" is given by , which reduces to the triangular formula at and the square formula at .
These show up in interviews less as "recite the formula" and more as counting puzzles in disguise: how many handshakes happen among people (triangular numbers, since it is choosing 2 out of ), or how many unit squares are in a triangular grid of side . Recognizing that a count is secretly a figurate number turns a fiddly enumeration into a one-line closed form. A useful identity worth memorizing is that every square number is the sum of two consecutive triangular numbers: , which follows directly from stacking two staircases of dots into a square.
Figurate numbers are dot-counts for growing regular shapes, with closed forms like for triangles and for squares; spotting that an interview counting problem is secretly a figurate number replaces manual enumeration with a one-line formula.