1996 AIME Problems/Problem 9

Revision as of 07:50, 25 September 2007 by 1=2 (talk | contribs)

Problem

A bored student walks down a hall that contains a row of closed lockers, numbered 1 to 1024. He opens the locker numbered 1, and then alternates between skipping and opening each locker thereafter. When he reaches the end of the hall, the student turns around and starts back. He opens the first closed locker he encounters, and then alternates between skipping and opening each closed locker thereafter. The student continues wandering back and forth in this manner until every locker is open. What is the number of the last locker he opens?

Solution

On his first pass, he opens all of the odd lockers. So there are only even lockers closed. Then he opens the lockers that are multiples of 4, leaving only lockers 2 mod 8 and 6 mod 8. Then he goes ahead and opens all lockers 2 mod 8, leaving lockers either 6 mod 16 or 14 mod 16. He then goes ahead and opens all lockers 14 mod 16, leaving the lockers either 6 mod 32 or 22 mod 32. He then goes ahead and opens all lockers 6 mod 32, leaving 22 mod 64 or 54 mod 64. He then opens 54 mod 64, leaving 22 mod 128 or 86 mod 128. He then opens 22 mod 128 and leaves 86 mod 256 and 214 mod 256. He then opens all 214 mod 256, so we have 86 mod 512 and 342 mod 512, leaving lockers 86, 342, 598, and 854, and he is at where he started again. He then opens 86 and 598, and then goes back and opens locker number 598, leaving locker number 342 untouched. He opens that locker.

See also

1996 AIME (ProblemsAnswer KeyResources)
Preceded by
Problem 8
Followed by
Problem 10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
All AIME Problems and Solutions