Quoto

Learn / Library / Brainteasers

Only odd walkers

BrainteasersMedium

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.

A whole number, a decimal, a fraction like 3/8 or a percent.

Hint

Locker is touched once for each odd divisor of .

Solution
  1. Write with odd; locker is touched once per divisor of .
  2. That count is odd exactly when is a perfect square, so is a square or a square multiplied by .
  3. Up to there are squares and numbers of the form : , , , , , and .
  4. So lockers are open.

Answer: