MediumBrain Teasers

100 Lockers

GoogleTwo Sigma

100 lockers start closed. Person i (for i = 1…100) toggles every locker that is a multiple of i. After all 100 people pass, how many lockers are open?

Approach

How many times is locker n toggled?

Which numbers have an odd number of divisors?

Related problems

More in Brain Teasers.