Solution

The Hundred Lockers

Show the problem again

100 lockers are closed. Person 1 toggles every locker, person 2 every 2nd locker, person 3 every 3rd, and so on through person 100. After all 100 passes, how many lockers are open?

Worked solution

The answer is 10: lockers 1, 4, 9, ..., 100. Locker n is toggled once per divisor of n, so it ends open iff n has an odd number of divisors. Divisors pair up as (d, n/d) except when d = √n, so only perfect squares have an odd count. There are 10 perfect squares up to 100.

Source: Classic locker-toggling parity puzzle in wide circulation; no traceable original source. Statement written for AxiomIQ.