Quoto

Learn / Library / Brainteasers

Corridor of lamps

BrainteasersEasy

A corridor has lamps numbered to , all off. For each from to in turn, a technician presses the switch of every lamp whose number is a multiple of ; each press turns a lamp on if it is off and off if it is on. How many lamps are on 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

A lamp is pressed once for each divisor of its number.

Solution
  1. Lamp is pressed once for every divisor of , and it ends on exactly when that count is odd.
  2. Divisors pair up as and , so the count is odd only when some divisor is paired with itself, that is when is a perfect square.
  3. The squares up to are to , since and .
  4. So lamps are on.

Answer: