返回题库

AIME 1996 · 第 9 题

AIME 1996 — Problem 9

专题
Contest Math
难度
L4
来源
AIME

题目详情

Problem

A bored student walks down a hall that contains a row of closed lockers, numbered 11 to 10241024. 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?

解析

Solutions

Solution 1

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 44, leaving only lockers 2(mod8)2 \pmod{8} and 6(mod8)6 \pmod{8}. Then he goes ahead and opens all lockers 2(mod8)2 \pmod {8}, leaving lockers either 6(mod16)6 \pmod {16} or 14(mod16)14 \pmod {16}. He then goes ahead and opens all lockers 14(mod16)14 \pmod {16}, leaving the lockers either 6(mod32)6 \pmod {32} or 22(mod32)22 \pmod {32}. He then goes ahead and opens all lockers 6(mod32)6 \pmod {32}, leaving 22(mod64)22 \pmod {64} or 54(mod64)54 \pmod {64}. He then opens 54(mod64)54 \pmod {64}, leaving 22(mod128)22 \pmod {128} or 86(mod128)86 \pmod {128}. He then opens 22(mod128)22 \pmod {128} and leaves 86(mod256)86 \pmod {256} and 214(mod256)214 \pmod {256}. He then opens all 214(mod256)214 \pmod {256}, so we have 86(mod512)86 \pmod {512} and 342(mod512)342 \pmod {512}, leaving lockers 86,342,59886, 342, 598, and 854854, and he is at where he started again. He then opens 8686 and 598598, and then goes back and opens locker number 854854, leaving locker number 342\boxed{342} untouched. He opens that locker.

~edit made by Yiyj1: the 2(mod8)2 \pmod 8 and 6(mod8)6\pmod 8 are the same as 2(mod4)2 \pmod 4.

Solution 2

We can also solve this with recursion. Let LnL_n be the last locker he opens given that he started with 2n2^n lockers. Let there be 2n2^n lockers. After he first reaches the end of the hallway, there are 2n12^{n-1} lockers remaining. There is a correspondence between these unopened lockers and if he began with 2n12^{n-1} lockers. The locker yy (if he started with 2n12^{n-1} lockers) corresponds to the locker 2n+22y2^n+2-2y (if he started with 2n2^n lockers). It follows that Ln=2n+22Ln1L_{n} = 2^{n} +2 -2L_{n-1} as they are corresponding lockers. We can compute L1=2L_1=2 and use the recursion to find L10=342L_{10}=\boxed{342}

Solution 3 (bash)

List all the numbers from 11 through 10241024, then do the process yourself!!! It will take about 25 minutes (if you don't start to see the pattern), but that's okay, eventually, you will get 342\boxed{342}.

(Note: If you try to do this, first look through all the problems! -Guy)

Solution 4 (bash but it takes less than 3 minutes)

Note that whenever the student makes a pass starting on one end, the number at the other end of that line will remain. This is very important.

Pass 00:

1,2,3,4...,10241,2,3,4...,1024

Pass 11:

2,4,6,...,1022,10242,4,6,...,1022, 1024

Pass 22 (reversed, note that we take the second-to-last term of the previous sequence for every new sequence):

1022,1018,...,(2+4),21022, 1018,...,(2+4), 2

Pass 33:

6,(6+4+4),...,(102244),10226, (6+4+4),...,(1022-4-4), 1022

Pass 44:

1014,(101416),...,(6+16),61014, (1014-16),..., (6+16), 6

Pass 55:

22,(22+32),...,(101432),101422, (22+32),..., (1014-32), 1014

Pass 66:

982,(98264),...,(22+64),22982, (982-64),..., (22 + 64), 22

Pass 77:

86,(86+128),...,(982128),98286, (86+128),..., (982-128), 982

Pass 88:

854,(854256),...,(86+256),86854, (854-256),..., (86+256), 86

Pass 99:

342,(342+512)342, (342+512)

Pass 1010:

342342

The answer is therefore 342.\boxed{342}.

~martianrunner


Edit from EthanSpoon, Doing this with only even numbers will make it faster. You'll see. 02496

Edit from Iamaimogoldmedalist. Doing some few rounds in your head till you get Multiples of 4 or possibly numbers of the form 8k+2 will enhance your speed.