25 lockers
A length of 25 lockers are in the hallway. The doors are all closed when guy #1 begins to walk by. He changes the state of each door - he opens all 25 locker doors.
Guy #2 walks by and changes the state of every second door. (He closes doors number 2,4,6 etc. Remember they were all open)
Guy #3 walks by and changes the state of each third door. (He closes open doors and opens closed doors. (doors 3,6,9 etc).
This continues with more and more guys. Each one changing the state of doors according to their number.
At some point, I took this picture of the lockers. Some open, some closed (the blue locker doors are closed).
How many guys had done their job at this point?
Guy #2 walks by and changes the state of every second door. (He closes doors number 2,4,6 etc. Remember they were all open)
Guy #3 walks by and changes the state of each third door. (He closes open doors and opens closed doors. (doors 3,6,9 etc).
This continues with more and more guys. Each one changing the state of doors according to their number.
At some point, I took this picture of the lockers. Some open, some closed (the blue locker doors are closed).
How many guys had done their job at this point?





10 Comments:
6 Guys have past the hallway
I have been beaten to it, but I make it 6 guys also.
Just a side comment - the original question did not highlight the direction in which the guys were walking down the hall (left-to-right or right-to-left). Fortunately, there is only one direction that offers a solution: left-to-right... (yeah, and I got 6 as well)...
6 is what i got as well.
The original state of a locker is closed.
If a locker has changed state an odd number of times, it will be open.
If a locker has changed state an even number of times it will be closed.
The number must be <=25 as no locker >25 exists in the hallway.
Lockers will change state when the number of guys who have acted is >= one of the factors of the locker number.
e.g. for locker 24, with factors
1,2,3,4,6,8,12,24. If 8 guys have walked down the hall the locker will have changed state 6 times, and 6 is even thus the locker will be closed.
Since prime numbers have only 2 factors (1 and itself) the fastest way to narrow down the number is to identify the largest prime numbers closed (the number of guys has exceeded that number, as the state has been changed twice back to the original state, i.e. both factors 1 and itself have been exceeded).
We quickly see 3 and 5 are closed
7 and larger prime numbers are open.
This narrows the solution down to:
>=5 and <7, i.e. 5 or 6
6 has factors: 1,2,3,6
if the locker 6 is open then number acted is <6, and if the locker is closed the number acted is >=6
The locker #6 is closed, thus the solution is 6
ANSWER:
6
Side note:
Direction of left to right or right to left wasn't identified in the problem, but was easily identified by looking at the 1st locker. Since 1 has only 1 factor, itself, The locker will always be open after the 1st guy acts. Left to right is the only possible configuration as Right to left has locker 1 closed.
Cam
Here's a row for 25 lockers for 25 guys
1 O O O O O O O O O O O O O O O O O O O O O O O O O
2 O C O C O C O C O C O C O C O C O C O C O C O C O
3 O C C C O O O C C C O O O C C C O O O C C C O O O
4 O C C O O O O O C C O C O C C O O O O O C C O C O
5 O C C O C O O O C O O C O C O O O O O C C C O C C
6 O C C O C C O O C O O O O C O O O C O C C C O O C
7 O C C O C C C O C O O O O O O O O C O C O C O O C
8 O C C O C C C C C O O O O O O C O C O C O C O C C
9 O C C O C C C C O O O O O O O C O O O C O C O C C
10 O C C O C C C C O C O O O O O C O O O O O C O C C
11 O C C O C C C C O C C O O O O C O O O O O O O C C
12 O C C O C C C C O C C C O O O C O O O O O O O O C
13 O C C O C C C C O C C C C O O C O O O O O O O O C
14 O C C O C C C C O C C C C C O C O O O O O O O O C
15 O C C O C C C C O C C C C C C C O O O O O O O O C
16 O C C O C C C C O C C C C C C O O O O O O O O O C
17 O C C O C C C C O C C C C C C O C O O O O O O O C
18 O C C O C C C C O C C C C C C O C C O O O O O O C
19 O C C O C C C C O C C C C C C O C C C O O O O O C
20 O C C O C C C C O C C C C C C O C C C C O O O O C
21 O C C O C C C C O C C C C C C O C C C C C O O O C
22 O C C O C C C C O C C C C C C O C C C C C C O O C
23 O C C O C C C C O C C C C C C O C C C C C C C O C
24 O C C O C C C C O C C C C C C O C C C C C C C C C
25 O C C O C C C C O C C C C C C O C C C C C C C C O
Interesting pattern there on line 25. That pattern holds up for any given number of lockers with equal number of guys..
The pattern being 1 open 2 closed 1 open 4 closed 1 open 6 closed 1 open 8 closed, etc... Each group of closed increases by 2 and are sepearted by an open..
Therefore, you can follow along the pattern until you see one wrong..
The pattern is:
O C C O C C C C O C C C C etc
The state of the lockers is
O C C O C C O O C O O O O ....
You'll see the first 6 matches and the 7th doesn't.. So 6 guys have finished..
This method will work on any number of lockers given any state to determine where the work stopped..
Fairly simple problem. The number of guys is 6 ... I used a chart just like the one Ragknot used. However, I did enjoy the logical solution posted by ? .. anonymous.
its 6 guys
i got 6 too
Post a Comment
Links to this post:
Create a Link
<< Home