Learn / Library / Brainteasers
Only odd walkers
A gym has lockers numbered to , all closed. Only the students with odd numbers walk past, , and student changes the state of every locker whose number is a multiple of , opening it if closed and closing it if open. How many lockers are open at the end?
Checking an answer needs JavaScript. The hint and the solution open without it.
Hint
Locker is touched once for each odd divisor of .
Solution
- Write with odd; locker is touched once per divisor of .
- That count is odd exactly when is a perfect square, so is a square or a square multiplied by .
- Up to there are squares and numbers of the form : , , , , , and .
- So lockers are open.
Answer: