hn.today

Making any integer with four 2s (2025)

eli.thegreenplace.net151 points37 comments
Screenshot of Making any integer with four 2s (2025)

The puzzle asks how to make a chosen natural number using exactly four copies of the digit 2 and mathematical operations. Simple arithmetic produces small targets such as 1 through 6, while exponents and factorials extend the range: examples include 256 as (2+2)^(2+2) and 65,536 as a tower of four 2s. Joining digits also helps, as in 26 = 22+2+2. Some targets, notably 7, prompt more elaborate tools such as the Gamma function. The puzzle can remain entertaining even at an advanced level, with complex numbers and other techniques opening further possibilities.

A general construction, attributed to Paul Dirac, uses repeated square roots and base-2 logarithms. Applying the square root n times to 2 gives 2 raised to the power 2^(-n); taking a base-2 logarithm twice then yields -n. Thus the number is encoded by how many nested square roots appear, rather than by writing it as a digit. This formula initially uses only three 2s, but replacing the outer logarithm’s base with √(2+2), which equals 2, supplies exactly the fourth. The result can represent any natural number using elementary operations; the practical difficulty is drawing the required number of nested roots.

Read on eli.thegreenplace.net37 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Science

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.