← Sun, Nov 8 digest

Making any integer with four 2s (2025)

read article ↗ hn thread ↗

Eli Bendersky explores a classic recreational math puzzle showing how Paul Dirac and others used four 2s and creative operations to generate any integer.

read it An engaging breakdown of a classic math puzzle and Dirac's clever general solution that rewards a full read.

summary

Eli Bendersky explores the classic mathematical puzzle of generating any integer using exactly four instances of the digit 2 and basic operations. The post traces how expanding allowable operators—from basic arithmetic to concatenation and advanced functions—unlocks difficult targets like 7. It highlights physicist Paul Dirac's general solution, which uses nested square roots and base-2 logarithms to systematically construct any integer.

key points

  1. Paul Dirac devised a general formula using nested square roots and base-2 logarithms to represent any natural number.
  2. Target numbers like 7 historically require advanced functions, rounding, or creative operator definitions to solve with only four 2s.
  3. Commenters heavily debate the pedantic boundaries of the rules, such as whether square roots or base-10 concatenation violate the spirit of using only four digits.

who should read it

Programmers and math enthusiasts interested in recreational puzzles and historical mathematical trivia.

discussion warm

consensus

Commenters enthusiastically engage with the puzzle, immediately debating edge cases, rule interpretations, and alternative mathematical formulations.

pushback

Some commenters push back on Dirac's solution, arguing that taking square roots implicitly consumes an extra 2 and violates the strict spirit of the rules.

best comment by shoo ↗

There's a direct trivial solution for any natural number using the successor function S(a) = a + 1 from Peano arithmetic.

Encode 0 as 2 + 2 - 2 - 2 then apply S a times to that 0.

Only depends upon natural numbers & Peano stuff, no need for construction of rationals, irrationals, logarithms, etc.

It introduces an alternative solution using Peano arithmetic and the successor function to generate any integer without complex functions.

Generated by an LLM from the article and thread. Check the sources before relying on it.