One hundred lockers
A corridor has 100 closed lockers, numbered 1 to 100. One hundred people walk past one after another. Person toggles every locker whose number is a multiple of : opens it if it is closed, closes it if it is open. So person 1 opens all the lockers, person 2 closes lockers 2, 4, 6, and so on.
How many lockers are open after all 100 people have passed?
Fractions, decimals with at least 3 significant digits, and expressions such as sqrt(2)/2, e^-1 or pi/4.
Locker is toggled once for each divisor of .
Divisors usually come in pairs and . When do they not?
h
s Shown after a correct answer. Revealing it first marks the problem as seen, not solved.
Idea. A locker ends up open exactly when it was toggled an odd number of times, that is when its number has an odd number of divisors. Only perfect squares do.
Step 1. Person touches locker exactly when divides . So locker is toggled once per divisor of , and it is open at the end if and only if has an odd number of divisors.
Step 2. The divisors of come in pairs . A pair has two different members unless , that is . So the number of divisors is odd exactly when is a perfect square. For example, 12 has divisors (even), while 16 has (odd).
Step 3. The perfect squares up to 100 are : there are 10 of them, so 10 lockers are open.
With 1000 lockers the same argument gives 31, since .