There are 100 lights, numbered 1 to 100, all starting in the OFF position. There are also 100 people, numbered 1 to 100, who walk past one after another. Person i toggles every switch that's a multiple of i — toggle just means flipping it, ON to OFF or OFF to ON.
Which lights will be ON after all 100 people have passed, and why?
Click "next" below to bring in people one at a time. Try it up to person 20 first, and see if a pattern shows up before you go any further.
the rule
- Person 1 toggles every switch.
- Person 2 toggles every 2nd switch.
- Person i toggles every ith switch.
- Person 100 toggles only switch 100.