Four 2s, Any Number: The Dirac Generalization
There’s a classic recreational math puzzle that scales nicely with the solver’s toolkit: given exactly four instances of the digit 2 and a target natural number, produce the target using only those 2s and any mathematical operations. No other digits allowed.
Early attempts rely on basic arithmetic. With exponents, factorials, and concatenation (treating 22 as two 2s), the range expands considerably. Some targets, like 7, resist these methods and seem to require heavier machinery — the Gamma function, for instance, makes short work of it. Enthusiasts have even drafted solutions involving integrals, continued fractions, and complex numbers, as seen in dedicated threads.
The puzzle has deep roots; it was a pastime for mathematicians in the 1920s. That era came to an end when Paul Dirac found a general construction that covers every natural number.
The Nested Square Root Trick
Dirac’s approach hinges on repeated square roots. If the square root is applied n times to a number, the exponent shrinks accordingly:
√(√(…√2)) = 2^(1/2^n)
Base-2 logarithms then convert that exponent back into a usable quantity:
log2(2^(1/2^n)) = 1/2^n
Taking the logarithm again yields n directly:
log2(log2(√…√2)) = log2(1/2^n) = −n
With this chain, any integer n can be built from a single 2 and enough nested roots. To encode an arbitrary target number, Dirac stacked a suitable sequence of operations. The only wrinkle: his original formula uses three instances of the digit 2, not four. The fix is straightforward — replace one 2 with √4, which is just another way of writing 2, bringing the count to exactly four.
For example, 7 can be expressed as:
log2(log2(√(√(√(√(√(√(√√4))))))))
The repeated roots themselves serve as the counter for n; no explicit digits are smuggled in. The construction is fully general, and the only real difficulty lies in typesetting all those nested radicals.
Historical Note
This account appears in Graham Farmelo’s biography The Strangest Man: The Hidden Life of Paul Dirac, Quantum Genius, which recounts the era when such puzzles were a respectable mathematical pastime — before Dirac’s elegant annihilation of the challenge.



