Wongo
1st March 2009, 08:49 PM
My mate Groggy gave me this challenge the other day. I found it interesting. Do you want to have a go? :U
In my daughter's school, there are 100 lockers, numbered 1 to 100; the summer break also happens to be exactly 100 days long; and even the cleaners are interested in numbers.
On the first day of summer, all the lockers are unlocked. The cleaner then walks by and, for every locker, locks it if it was unlocked, and unlocks it if it was locked. (Since all the lockers were unlocked, that means he locks each one.)
On the second day, the cleaner walks by and, for every 2nd locker starting with #2, locks it if it was unlocked, and unlocks it if it was locked. (Since all the lockers were locked after the first day, that means he unlocks each one.)
On the third day, he walks by and, for every 3rd locker starting with #3, locks it if it was unlocked, and unlocks it if it was locked. (Now, some lockers get locked and some unlocked.)
On the Nth day, of course, he walks by and, for every Nth locker starting with #N, locks it if it was unlocked, and unlocks it if it was locked.
After 100 days, how many lockers are locked?
In my daughter's school, there are 100 lockers, numbered 1 to 100; the summer break also happens to be exactly 100 days long; and even the cleaners are interested in numbers.
On the first day of summer, all the lockers are unlocked. The cleaner then walks by and, for every locker, locks it if it was unlocked, and unlocks it if it was locked. (Since all the lockers were unlocked, that means he locks each one.)
On the second day, the cleaner walks by and, for every 2nd locker starting with #2, locks it if it was unlocked, and unlocks it if it was locked. (Since all the lockers were locked after the first day, that means he unlocks each one.)
On the third day, he walks by and, for every 3rd locker starting with #3, locks it if it was unlocked, and unlocks it if it was locked. (Now, some lockers get locked and some unlocked.)
On the Nth day, of course, he walks by and, for every Nth locker starting with #N, locks it if it was unlocked, and unlocks it if it was locked.
After 100 days, how many lockers are locked?