90 seconds of Gauss / sum-of-squares / sum-of-cubes formulas
Technique: Three closed-form formulas
Three identities collapse the “sum the first n” problem from a loop into a single computation:
1 + 2 + … + n = n(n+1) / 21² + 2² + … + n² = n(n+1)(2n+1) / 61³ + 2³ + … + n³ = (n(n+1)/2)² (square of the Gauss sum!)1 + 2 + … + 50 = 50×51/2 = 12751² + 2² + … + 10² = 10×11×21/6 = 2310/6 = 3851³ + 2³ + … + 5³ = (15)² = 225The Gauss sum is the classic schoolboy story — pair off 1+n, 2+(n-1), …, each pair sums to n+1, there are n/2 pairs. The Σn² and Σn³ formulas come from telescoping or induction; the elegant fact that Σn³ = (Σn)² is worth memorising on its own.
These show up under interview questions framed as “cumulative cost,” “triangle / pyramid totals,” or anywhere you can substitute a closed form for a loop. Every question has a 30 second shot clock.
Bug, wording issue, or polish suggestion — all go straight into the dogfood backlog.