TrialAndError BrainTeaser SquareNumber Intermediate

Problem - 4142

There are $100$ lights lined up in a long room. Each light has its own switch and is currently off. The room has an entry door and an exit door. There are $100$ people lined up outside the entry door. Each light is numbered consecutively from $1$ to $100$. So is each person.

Person No. $1$ enters the room, switches on every light, and exits. Person No. $2$ enters and flips the switch on every second light (i.e. turn off lights $2$, $4$, $6$...). Person No. $3$ enters and flips the switch on every third light (i.e. toggle lights $3$, $6$, $9$...). This continues until all $100$ people have passed through the room. How many of the lights are on at the end?


Answer     10

$\textbf{Answer}$

The answer is $10$. All the lights whose labels are square numbers are on. The rest are off.

$\textbf{Analysis}$

It is easy to see that

  • Light $1$ will be on (switched once)
  • Light $2$ will be off (switched twice)
  • Light $3$ will be off (switched twice)
  • Light $4$ will be on (switched three times)
  • Light $5$ will be off (switched twice)
  • Light $6$ will be off (switched four times)
  • Light $7$ will be off (switched twice)
  • Light $8$ will be off (switched four times)
  • Light $9$ will be on (switched three times)
  • $\cdots$

It may become clear that a light will remain on if and only if it is switched an odd number of times. This makes sense, doesn't it? Therefore, the problem becomes how to determine which lights will be switched an odd number of times. This is equivalent to determining which integers have an odd number of divisors. Only square numbers meet this requirement. 

report an error