Friday, October 27, 2006

Friday Math Problem

Lockers in a row are numbered 1,2,3, . . . ,1000. At first, all the lockers are closed. A person walks by, and opens every other locker, starting with locker #2. Thus lockers 2,4,6, . . . ,998,1000 are open. Another person walks by, and changes the state of every third locker, starting with locker #3. Then another person changes the state of every fourth locker, starting with #4, etc. This process continues until no more lockers can be altered. Which lockers will be closed?

4 Comments:

At 10/28/2006 1:16 AM, Jeff Galak said...

1,4,9,25,...,900,961.

:)

 
At 10/29/2006 10:58 PM, Mars the Infomage said...

I already know the answer :( but reminds me of the classic Google problem:
"<blah blah> N lockers, all open. If the first person goes by and toggles all the lockers, write a program to efficiently index all the web pages on the internet."

Keep these things coming though, they're cool :)

 
At 10/30/2006 9:14 AM, uhclem said...

Only locker one. After 999 people have walked by, each has opened locker (n+1).

Reminded me of Martin Gardener's hotel with an infinite number of rooms, all filled.
a) one new guest shows up. How do you fit him in?
b) infinite new guests turn up. How do you fit them in?

 
At 10/30/2006 9:59 AM, andrew@mit said...

answe is, all the lockers that are perfect squares. proof is coming in email.

 

Post a Comment

<< Home