5 & 21 Cent Stamp Puzzle

Largest amount with 5 and 21 stamps is an easy quant interview question on Brain Teasers, reported to have been seen at Goldman Sachs and Jane Street.

Difficulty Easy Topic Brain Teasers Reported at Goldman Sachs, Jane Street

MyQuantPartner is not affiliated with, endorsed by, or sponsored by these companies, and all trademarks belong to their respective owners.

This classic stamp puzzle is about understanding which values can and cannot be built from fixed denominations, a theme that appears often in quant interviews and brain teasers. It captures the idea of expressing numbers as combinations of simpler building blocks, a concept that links arithmetic, number theory, and modular thinking in a very concrete way.

It trains recognition of hidden mathematical structure in an apparently simple setup, along with comfort manipulating integer combinations and reasoning about coverage and gaps. It reinforces intuition for coprimality, residues, and when a system of discrete units becomes "complete," all of which are highly relevant in rigorous quant prep.

This matters in quant interviews because it reveals whether you can spot a general pattern behind a simple puzzle, articulate the governing principle, and connect a neat closed-form result to broader problem classes in quantitative finance.

What it tests

When combining two positive integers with greatest common divisor 1 (coprime), the largest integer that cannot be expressed as a non-negative integer combination of the two is given by the formula $mn - m - n$, where $m$ and $n$ are the two values. This is known as the Frobenius number for two variables. The reason this works is that, beyond a certain threshold, every sufficiently large integer can be expressed as a linear combination of $m$ and $n$, because their coprimality ensures that their linear combinations eventually fill all residue classes modulo each other. The structure of the problem is governed by modular arithmetic: once you can make all residues modulo $m$ using $n$, you can reach every larger number by adding multiples of $m$. The principle generalizes to any pair of positive coprime denominations, not just stamps.

Practise this question with written feedback, or hear it in a spoken mock interview.

Get started free