Difference between revisions of "2024 AIME I Problems/Problem 3"

(Solution 1)
(Solution 6 (for dummies))
 
(43 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 
==Problem==
 
==Problem==
  
Alice and Bob play the following game. A stack of n tokens lies before them. The players take turns with Alice going first. On each turn, the player removes either 1 token or 4 tokens from the stack. Whoever removes the last token wins. Find the number of positive integers n less than or equal to 2024 for which there exists a strategy for Bob that guarantees that Bob will win the game regardless of Alice's play.
+
Alice and Bob play the following game. A stack of <math>n</math> tokens lies before them. The players take turns with Alice going first. On each turn, the player removes either <math>1</math> token or <math>4</math> tokens from the stack. Whoever removes the last token wins. Find the number of positive integers <math>n</math> less than or equal to <math>2024</math> for which there exists a strategy for Bob that guarantees that Bob will win the game regardless of Alice's play.
  
 
==Solution 1==
 
==Solution 1==
Let's first try some experimentation. Alice obviously wins if there is one coin. She will just take it and win. If there are 2, then Alice will take one and then Bob will take one. If there are 3, Alice will take 1, Bob will take one, and Alice will take the final one. If there are 4, Alice will just remove all 4 at once. If there are 5, no matter what Alice does, Bob can take the final coins in one try. Notice that Alice wins if there are 1, 3, or 4 coins left. Bob wins if there are 2 or 5 coins left. After some thought, you may realize that there is a strategy for Bob. If he can just ensure that there are 5 coins remaining, he wins. Any multiple of 5 will also work. The reason for this is the following: Let's say there are a multiple of 5 coins remaining in the stack. If Alice takes 1, Bob will take 4, and there will still be a multiple of 5. If Alice takes 4, Bob will take 1, and there will still be a multiple of 5. This process will continue until you get 0 coins left.
+
Let's first try some experimentation. Alice obviously wins if there is one coin. She will just take it and win. If there are 2 remaining, then Alice will take one and then Bob will take one, so Bob wins. If there are <math>3</math>, Alice will take <math>1</math>, Bob will take one, and Alice will take the final one. If there are <math>4</math>, Alice will just remove all <math>4</math> at once. If there are <math>5</math>, no matter what Alice does, Bob can take the final coins in one try. Notice that Alice wins if there are <math>1</math>, <math>3</math>, or <math>4</math> coins left. Bob wins if there are <math>2</math> or <math>5</math> coins left.
  
After some more experimentation, you'll realize that any number that is congruent to 2 mod 5 will also work. This is because Bob can do the same strategy, and when there are 2 coins left, Alice is forced to take 1 and Bob takes the final one.
+
After some thought, you may realize that there is a strategy for Bob. If there is n is a multiple of <math>5</math>, then Bob will win. The reason for this is the following: Let's say there are a multiple of <math>5</math> coins remaining in the stack. If Alice takes <math>1</math>, Bob will take <math>4</math>, and there will still be a multiple of <math>5</math>. If Alice takes <math>4</math>, Bob will take <math>1</math>, and there will still be a multiple of <math>5</math>. This process will continue until you get <math>0</math> coins left. For example, let's say there are <math>205</math> coins. No matter what Alice does, Bob can simply just do the complement. After each of them make a turn, there will always be a multiple of <math>5</math> left. This will continue until there are <math>5</math> coins left, and Bob will end up winning.
  
So we have to find the number of numbers less than or equal to 2024 that are either congruent to 0 mod 5 or 2 mod 5. There are 404 numbers in the first category: 5, 10, 15, ..., 2020. For the second category, there are 405 numbers. 2, 7, 12, 17, ..., 2022. So the answer is 404 + 405 = <math>\boxed{809}</math>
+
After some more experimentation, you'll realize that any number that is congruent to <math>2</math> mod <math>5</math> will also work. This is because Bob can do the same strategy, and when there are <math>2</math> coins left, Alice is forced to take <math>1</math> and Bob takes the final coin. For example, let's say there are <math>72</math> coins. If Alice takes <math>1</math>, Bob will take <math>4</math>. If Alice takes <math>4</math>, Bob will take <math>1</math>. So after they each make a turn, the number will always be equal to <math>2</math> mod <math>5</math>. Eventually, there will be only <math>2</math> coins remaining, and we've established that Alice will simply take <math>1</math> and Bob will take the final coin.
 +
 
 +
So we have to find the number of numbers less than or equal to <math>2024</math> that are either congruent to <math>0</math> mod <math>5</math> or <math>2</math> mod <math>5</math>. There are <math>404</math> numbers in the first category: <math>5, 10, 15, \dots, 2020</math>. For the second category, there are <math>405</math> numbers. <math>2, 7, 12, 17, \dots, 2022</math>. So the answer is <math>404 + 405 = \boxed{809}</math>
  
 
~lprado
 
~lprado
 +
 +
==Solution 2==
 +
Let's use winning and losing positions, where <math>W</math> marks a win for Alice.
 +
 +
<math>1</math> coin: <math>W</math>
 +
 +
<math>2</math> coins: <math>L</math>
 +
 +
<math>3</math> coins: <math>W</math>
 +
 +
<math>4</math> coins: <math>W</math>
 +
 +
<math>5</math> coins: <math>L</math>
 +
 +
<math>6</math> coin: <math>W</math>
 +
 +
<math>7</math> coins: <math>L</math>
 +
 +
<math>8</math> coins: <math>W</math>
 +
 +
<math>9</math> coins: <math>W</math>
 +
 +
<math>10</math> coins: <math>L</math>
 +
 +
<math>11</math> coin: <math>W</math>
 +
 +
<math>12</math> coins: <math>L</math>
 +
 +
<math>13</math> coins: <math>W</math>
 +
 +
<math>14</math> coins: <math>W</math>
 +
 +
<math>15</math> coins: <math>L</math>
 +
 +
We can see that losing positions occur when <math>n</math> is congruent to <math>0, 2 \mod{5}</math> and winning positions occur otherwise. As <math>n</math> ranges from <math>1</math> to <math>2020</math>, <math>\frac{2}{5}</math> of these values are losing positions where Bob will win. As <math>n</math> ranges from <math>2021</math> to <math>2024</math>, <math>2022</math> is the only value where Bob will win. Thus, the answer is <math>2020\times\frac{2}{5}+1=\boxed{809}</math>
 +
 +
~alexanderruan
 +
 +
==Solution 3==
 +
 +
Denote by <math>A_i</math> and <math>B_i</math> Alice's or Bob's <math>i</math>th moves, respectively.
 +
 +
Case 1: <math>n \equiv 0 \pmod{5}</math>.
 +
 +
Bob can always take the strategy that <math>B_i = 5 - A_i</math>.
 +
This guarantees him to win.
 +
 +
In this case, the number of <math>n</math> is <math>\left\lfloor \frac{2024}{5} \right\rfloor = 404</math>.
 +
 +
Case 2: <math>n \equiv 1 \pmod{5}</math>.
 +
 +
In this case, consider Alice's following strategy: <math>A_1 = 1</math> and <math>A_i = 5 - B_{i-1}</math> for <math>i \geq 2</math>.
 +
Thus, under Alice's this strategy, Bob has no way to win.
 +
 +
Case 3: <math>n \equiv 4 \pmod{5}</math>.
 +
 +
In this case, consider Alice's following strategy: <math>A_1 = 4</math> and <math>A_i = 5 - B_{i-1}</math> for <math>i \geq 2</math>.
 +
Thus, under Alice's this strategy, Bob has no way to win.
 +
 +
Case 4: <math>n \equiv 2 \pmod{5}</math>.
 +
 +
Bob can always take the strategy that <math>B_i = 5 - A_i</math>.
 +
Therefore, after the <math>\left\lfloor \frac{n}{5} \right\rfloor</math>th turn, there are two tokens leftover.
 +
Therefore, Alice must take 1 in the next turn that leaves the last token on the table.
 +
Therefore, Bob can take the last token to win the game.
 +
This guarantees him to win.
 +
 +
In this case, the number of <math>n</math> is <math>\left\lfloor \frac{2024 - 2}{5} \right\rfloor +1 = 405</math>.
 +
 +
Case 5: <math>n \equiv 3 \pmod{5}</math>.
 +
 +
Consider Alice's following strategy: <math>A_1 = 1</math> and <math>A_i = 5 - B_{i-1}</math> for <math>i \geq 2</math>.
 +
By doing so, there will finally be 2 tokens on the table and Bob moves first. Because Bob has the only choice of taking 1 token, Alice can take the last token and win the game.
 +
 +
Therefore, in this case, under Alice's this strategy, Bob has no way to win.
 +
 +
Putting all cases together, the answer is <math>404 + 405 = \boxed{\textbf{(809) }}</math>.
 +
 +
 +
==Solution 4 (Grundy Values)==
 +
 +
Since the game Alice and Bob play is impartial (the only difference between player 1 and player 2 is that player 1 goes first (note that games like chess are not impartial because each player can only move their own pieces)), we can use the Sprague-Grundy Theorem to solve this problem. We will use induction to calculate the Grundy Values for this game.
 +
 +
We claim that heaps of size congruent to <math>0,2 \bmod{5}</math> will be in outcome class <math>\mathcal{P}</math> (win for player 2 = Bob), and heaps of size equivalent to <math>1,3,4 \bmod{5}</math> will be in outcome class <math>\mathcal{N}</math> (win for player 1 = Alice). Note that the mex (minimal excludant) of a set of nonnegative integers is the least nonnegative integer not in the set. e.g. mex<math>(1, 2, 3) = 0</math> and mex<math>(0, 1, 2, 4) = 3</math>.
 +
 +
 +
<math>\text{heap}(0) = \{\} = *\text{mex}(\emptyset) = 0</math>
 +
 +
 +
<math>\text{heap}(1) = \{0\} = *\text{mex}(0) = *</math>
 +
 +
 +
<math>\text{heap}(2) = \{*\} = *\text{mex}(1) = 0</math>
 +
 +
 +
<math>\text{heap}(3) = \{0\} = *\text{mex}(0) = *</math>
 +
 +
 +
<math>\text{heap}(4) = \{0, *\} = *\text{mex}(0, 1) = *2</math>
 +
 +
 +
<math>\text{heap}(5) = \{*, *2\} = *\text{mex}(1, 2) = 0</math>
 +
 +
 +
<math>\text{heap}(6) = \{0, 0\} = *\text{mex}(0, 0) = *</math>
 +
 +
 +
<math>\text{heap}(7) = \{*, *\} = *\text{mex}(1, 1) = 0</math>
 +
 +
 +
<math>\text{heap}(8) = \{*2, 0\} = *\text{mex}(0, 2) = *</math>
 +
 +
 +
<math>\text{heap}(9) = \{0, *\} = *\text{mex}(0, 1) = *2</math>
 +
 +
 +
<math>\text{heap}(10) = \{*, *2\} = *\text{mex}(1, 2) = 0</math>
 +
 +
 +
We have proven the base case. We will now prove the inductive hypothesis: If <math>n \equiv 0 \bmod{5}</math>, <math>\text{heap}(n) = 0</math>, <math>\text{heap}(n+1) = *</math>, <math>\text{heap}(n+2) = 0</math>, <math>\text{heap}(n+3) = *</math>, and <math>\text{heap}(n+4) = *2</math>, then <math>\text{heap}(n+5) = 0</math>, <math>\text{heap}(n+6) = *</math>, <math>\text{heap}(n+7) = 0</math>, <math>\text{heap}(n+8) = *</math>, and <math>\text{heap}(n+9) = *2</math>.
 +
 +
 +
<math>\text{heap}(n+5) = \{\text{heap}(n+1), \text{heap}(n+4)\} = \{*, *2\} = *\text{mex}(1, 2) = 0</math>
 +
 +
 +
<math>\text{heap}(n+6) = \{\text{heap}(n+2), \text{heap}(n+5)\} = \{0, 0\} = *\text{mex}(0, 0) = *</math>
 +
 +
 +
<math>\text{heap}(n+7) = \{\text{heap}(n+3), \text{heap}(n+6)\} = \{*, *\} = *\text{mex}(1, 1) = 0</math>
 +
 +
 +
<math>\text{heap}(n+8) = \{\text{heap}(n+4), \text{heap}(n+7)\} = \{*2, 0\} = *\text{mex}(2, 1) = *</math>
 +
 +
 +
<math>\text{heap}(n+9) = \{\text{heap}(n+5), \text{heap}(n+8)\} = \{0, *\} = *\text{mex}(0, 1) = *2</math>
 +
 +
 +
We have proven the inductive hypothesis. QED.
 +
 +
There are <math>2020*\frac{2}{5}=808</math> positive integers congruent to <math>0,2 \bmod{5}</math> between 1 and 2020, and 1 such integer between 2021 and 2024. <math>808 + 1 = \boxed{809}</math>.
 +
 +
 +
~numerophile
 +
==Solution 5 (no modular arithmetic)==
 +
We start with <math>n</math> as some of the smaller values. After seeing the first 4 where Bob wins automatically, with trial and error we see that <math>2, 5, 7,</math> and <math>10</math> are spaced alternating in between 2 and 3 apart. This can also be proven with modular arithmetic, but  this is an easier solution for some people. We split them into 2 different sets with common difference 5: {2,7,12 ...} and {5,10,15...}. Counting up all the numbers in each set can be done as follows:
 +
 +
Set 1 <math>{2,7,12...}</math>
 +
 +
<math>2024-2=2022</math> (because the first term is two)
 +
 +
<math>\lfloor \frac{2024}{5} \rfloor = 404</math>
 +
 +
Set 2 <math>{5,10,15}</math>
 +
 +
<math>\lfloor \frac{2024}{5} \rfloor = 404</math>
 +
 +
 +
And because we forgot 2022 we add 1 more.
 +
 +
<math>404+404+1=809</math>
 +
 +
-Multpi12
 +
(Edits would be appreciated)
 +
LaTexed by BossLu99
 +
==Video Solution==
 +
 +
https://youtu.be/SM4UhX00LMo
 +
 +
~Veer Mahajan
 +
 +
==Video Solution==
 +
 +
https://youtu.be/maUmj9kQ6pg
 +
 +
~Steven Chen (Professor Chen Education Palace, www.professorchenedu.com)
 +
 +
==See also==
 +
 +
Might be a good reference: https://www.youtube.com/watch?v=qMFpOcLroOg (from TedEd Riddles)
 +
 +
~ek-nalshtheguy
 +
 +
{{AIME box|year=2024|n=I|num-b=2|num-a=4}}
 +
 +
{{MAA Notice}}

Latest revision as of 14:16, 14 September 2024

Problem

Alice and Bob play the following game. A stack of $n$ tokens lies before them. The players take turns with Alice going first. On each turn, the player removes either $1$ token or $4$ tokens from the stack. Whoever removes the last token wins. Find the number of positive integers $n$ less than or equal to $2024$ for which there exists a strategy for Bob that guarantees that Bob will win the game regardless of Alice's play.

Solution 1

Let's first try some experimentation. Alice obviously wins if there is one coin. She will just take it and win. If there are 2 remaining, then Alice will take one and then Bob will take one, so Bob wins. If there are $3$, Alice will take $1$, Bob will take one, and Alice will take the final one. If there are $4$, Alice will just remove all $4$ at once. If there are $5$, no matter what Alice does, Bob can take the final coins in one try. Notice that Alice wins if there are $1$, $3$, or $4$ coins left. Bob wins if there are $2$ or $5$ coins left.

After some thought, you may realize that there is a strategy for Bob. If there is n is a multiple of $5$, then Bob will win. The reason for this is the following: Let's say there are a multiple of $5$ coins remaining in the stack. If Alice takes $1$, Bob will take $4$, and there will still be a multiple of $5$. If Alice takes $4$, Bob will take $1$, and there will still be a multiple of $5$. This process will continue until you get $0$ coins left. For example, let's say there are $205$ coins. No matter what Alice does, Bob can simply just do the complement. After each of them make a turn, there will always be a multiple of $5$ left. This will continue until there are $5$ coins left, and Bob will end up winning.

After some more experimentation, you'll realize that any number that is congruent to $2$ mod $5$ will also work. This is because Bob can do the same strategy, and when there are $2$ coins left, Alice is forced to take $1$ and Bob takes the final coin. For example, let's say there are $72$ coins. If Alice takes $1$, Bob will take $4$. If Alice takes $4$, Bob will take $1$. So after they each make a turn, the number will always be equal to $2$ mod $5$. Eventually, there will be only $2$ coins remaining, and we've established that Alice will simply take $1$ and Bob will take the final coin.

So we have to find the number of numbers less than or equal to $2024$ that are either congruent to $0$ mod $5$ or $2$ mod $5$. There are $404$ numbers in the first category: $5, 10, 15, \dots, 2020$. For the second category, there are $405$ numbers. $2, 7, 12, 17, \dots, 2022$. So the answer is $404 + 405 = \boxed{809}$

~lprado

Solution 2

Let's use winning and losing positions, where $W$ marks a win for Alice.

$1$ coin: $W$

$2$ coins: $L$

$3$ coins: $W$

$4$ coins: $W$

$5$ coins: $L$

$6$ coin: $W$

$7$ coins: $L$

$8$ coins: $W$

$9$ coins: $W$

$10$ coins: $L$

$11$ coin: $W$

$12$ coins: $L$

$13$ coins: $W$

$14$ coins: $W$

$15$ coins: $L$

We can see that losing positions occur when $n$ is congruent to $0, 2 \mod{5}$ and winning positions occur otherwise. As $n$ ranges from $1$ to $2020$, $\frac{2}{5}$ of these values are losing positions where Bob will win. As $n$ ranges from $2021$ to $2024$, $2022$ is the only value where Bob will win. Thus, the answer is $2020\times\frac{2}{5}+1=\boxed{809}$

~alexanderruan

Solution 3

Denote by $A_i$ and $B_i$ Alice's or Bob's $i$th moves, respectively.

Case 1: $n \equiv 0 \pmod{5}$.

Bob can always take the strategy that $B_i = 5 - A_i$. This guarantees him to win.

In this case, the number of $n$ is $\left\lfloor \frac{2024}{5} \right\rfloor = 404$.

Case 2: $n \equiv 1 \pmod{5}$.

In this case, consider Alice's following strategy: $A_1 = 1$ and $A_i = 5 - B_{i-1}$ for $i \geq 2$. Thus, under Alice's this strategy, Bob has no way to win.

Case 3: $n \equiv 4 \pmod{5}$.

In this case, consider Alice's following strategy: $A_1 = 4$ and $A_i = 5 - B_{i-1}$ for $i \geq 2$. Thus, under Alice's this strategy, Bob has no way to win.

Case 4: $n \equiv 2 \pmod{5}$.

Bob can always take the strategy that $B_i = 5 - A_i$. Therefore, after the $\left\lfloor \frac{n}{5} \right\rfloor$th turn, there are two tokens leftover. Therefore, Alice must take 1 in the next turn that leaves the last token on the table. Therefore, Bob can take the last token to win the game. This guarantees him to win.

In this case, the number of $n$ is $\left\lfloor \frac{2024 - 2}{5} \right\rfloor +1 = 405$.

Case 5: $n \equiv 3 \pmod{5}$.

Consider Alice's following strategy: $A_1 = 1$ and $A_i = 5 - B_{i-1}$ for $i \geq 2$. By doing so, there will finally be 2 tokens on the table and Bob moves first. Because Bob has the only choice of taking 1 token, Alice can take the last token and win the game.

Therefore, in this case, under Alice's this strategy, Bob has no way to win.

Putting all cases together, the answer is $404 + 405 = \boxed{\textbf{(809) }}$.


Solution 4 (Grundy Values)

Since the game Alice and Bob play is impartial (the only difference between player 1 and player 2 is that player 1 goes first (note that games like chess are not impartial because each player can only move their own pieces)), we can use the Sprague-Grundy Theorem to solve this problem. We will use induction to calculate the Grundy Values for this game.

We claim that heaps of size congruent to $0,2 \bmod{5}$ will be in outcome class $\mathcal{P}$ (win for player 2 = Bob), and heaps of size equivalent to $1,3,4 \bmod{5}$ will be in outcome class $\mathcal{N}$ (win for player 1 = Alice). Note that the mex (minimal excludant) of a set of nonnegative integers is the least nonnegative integer not in the set. e.g. mex$(1, 2, 3) = 0$ and mex$(0, 1, 2, 4) = 3$.


$\text{heap}(0) = \{\} = *\text{mex}(\emptyset) = 0$


$\text{heap}(1) = \{0\} = *\text{mex}(0) = *$


$\text{heap}(2) = \{*\} = *\text{mex}(1) = 0$


$\text{heap}(3) = \{0\} = *\text{mex}(0) = *$


$\text{heap}(4) = \{0, *\} = *\text{mex}(0, 1) = *2$


$\text{heap}(5) = \{*, *2\} = *\text{mex}(1, 2) = 0$


$\text{heap}(6) = \{0, 0\} = *\text{mex}(0, 0) = *$


$\text{heap}(7) = \{*, *\} = *\text{mex}(1, 1) = 0$


$\text{heap}(8) = \{*2, 0\} = *\text{mex}(0, 2) = *$


$\text{heap}(9) = \{0, *\} = *\text{mex}(0, 1) = *2$


$\text{heap}(10) = \{*, *2\} = *\text{mex}(1, 2) = 0$


We have proven the base case. We will now prove the inductive hypothesis: If $n \equiv 0 \bmod{5}$, $\text{heap}(n) = 0$, $\text{heap}(n+1) = *$, $\text{heap}(n+2) = 0$, $\text{heap}(n+3) = *$, and $\text{heap}(n+4) = *2$, then $\text{heap}(n+5) = 0$, $\text{heap}(n+6) = *$, $\text{heap}(n+7) = 0$, $\text{heap}(n+8) = *$, and $\text{heap}(n+9) = *2$.


$\text{heap}(n+5) = \{\text{heap}(n+1), \text{heap}(n+4)\} = \{*, *2\} = *\text{mex}(1, 2) = 0$


$\text{heap}(n+6) = \{\text{heap}(n+2), \text{heap}(n+5)\} = \{0, 0\} = *\text{mex}(0, 0) = *$


$\text{heap}(n+7) = \{\text{heap}(n+3), \text{heap}(n+6)\} = \{*, *\} = *\text{mex}(1, 1) = 0$


$\text{heap}(n+8) = \{\text{heap}(n+4), \text{heap}(n+7)\} = \{*2, 0\} = *\text{mex}(2, 1) = *$


$\text{heap}(n+9) = \{\text{heap}(n+5), \text{heap}(n+8)\} = \{0, *\} = *\text{mex}(0, 1) = *2$


We have proven the inductive hypothesis. QED.

There are $2020*\frac{2}{5}=808$ positive integers congruent to $0,2 \bmod{5}$ between 1 and 2020, and 1 such integer between 2021 and 2024. $808 + 1 = \boxed{809}$.


~numerophile

Solution 5 (no modular arithmetic)

We start with $n$ as some of the smaller values. After seeing the first 4 where Bob wins automatically, with trial and error we see that $2, 5, 7,$ and $10$ are spaced alternating in between 2 and 3 apart. This can also be proven with modular arithmetic, but this is an easier solution for some people. We split them into 2 different sets with common difference 5: {2,7,12 ...} and {5,10,15...}. Counting up all the numbers in each set can be done as follows:

Set 1 ${2,7,12...}$

$2024-2=2022$ (because the first term is two)

$\lfloor \frac{2024}{5} \rfloor = 404$

Set 2 ${5,10,15}$

$\lfloor \frac{2024}{5} \rfloor = 404$


And because we forgot 2022 we add 1 more.

$404+404+1=809$

-Multpi12 (Edits would be appreciated) LaTexed by BossLu99

Video Solution

https://youtu.be/SM4UhX00LMo

~Veer Mahajan

Video Solution

https://youtu.be/maUmj9kQ6pg

~Steven Chen (Professor Chen Education Palace, www.professorchenedu.com)

See also

Might be a good reference: https://www.youtube.com/watch?v=qMFpOcLroOg (from TedEd Riddles)

~ek-nalshtheguy

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

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. AMC logo.png