Calvin and Brian play a game which begins with a pile of n toothpicks. They alternate turns with Calvin going first. On each player's turn, he must remove either 1,3 or 4 toothpicks from the pile. The player who removes the last toothpick wins the game.
Find the sum of the values of n from 31 to 35 inclusive for which Calvin has a winning strategy.
Bonus - Some interesting extensions: Can you figure out who has a winning strategy for n = 1 0 0 ? Can you determine a complete list of winning positions for Calvin and Brian? What if, instead of removing 1,3 or 4, they remove 1,2 or 4. How about 1,3 or 6?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
We can generate two lists of numbers iteratively, one where Calvin can have a winning strategy and one where he can't. Where list W is the winning numbers and L is the losing numbers, we start our lists as the following:
W = { 1 , 3 , 4 }
L = { 2 }
Clearly Calvin can win on anything in the win group simply by subtracting 1 , 3 or 4 . He can't win with 2 because he can only take away 1 and then Brian would take the last toothpick.
Our strategy goes as follows. If Calvin can subtract 1 , 3 or 4 toothpicks to get a number on the losing list, then that would be a winning strategy for Calvin and that number is added to the winning list. If he can't, then that number is added to the losing list. Using this algorithm we can generate the lists as follows:
W = { 1 , 3 , 4 , 5 , 6 , 8 , 1 0 , 1 1 , 1 2 , 1 3 , 1 5 , 1 7 , 1 8 , 1 9 , 2 0 , 2 2 , 2 4 , 2 5 , 2 6 , 2 7 , 2 9 , 3 1 , 3 2 , 3 3 , 3 4 }
L = { 2 , 7 , 9 , 1 4 , 1 6 , 2 1 , 2 3 , 2 8 , 3 0 , 3 5 }
It's clear that a pattern emerges, showing that all our numbers on the losing list are of the form 7 k and 7 k + 2 . For n ∈ [ 3 1 , 3 5 ] , there are 4 winning strategies: 3 1 , 3 2 , 3 3 & 3 4 , meaning that our answer must be:
3 1 + 3 2 + 3 3 + 3 4 = 1 3 0
Problem Loading...
Note Loading...
Set Loading...
Calvin has a winning strategy exactly when n ≡ 0 , 2 ( m o d 7 ) . It's easy to check that this holds for the first few values of n . Inductive, assume this is true for all n < k . Take n = k . If k = 0 , 2 ( m o d 7 ) , then for some m ∈ { 1 , 3 , 4 } , k − m ≡ 0 or 2 ( m o d 7 ) . By inductive hypothesis, Brian loses. However, if k ≡ 0 or 2 ( m o d 7 ) , then for any choice of m , k − m ≡ 0 , 2 ( m o d 7 ) . Therefore, Brian wins.
Thus, Calvin has a winning strategy when n = 3 1 , 3 2 , 3 3 , 3 4 but not 3 5 , so the answer is 1 3 0 .
Unfortunately, 1 0 0 ≡ 2 ( m o d 7 ) , so Calvin does not have a winning strategy when there are 1 0 0 toothpicks.
Similarly, if they are allowed to remove 1 , 2 , 4 or 1 , 3 , 6 toothpicks, Calvin has a winning strategy for n ≡ 0 ( m o d 3 ) , n ≡ 0 , 2 , 4 ( m o d 9 ) , respectively. In either case, Calvin has a winning strategy when there are 1 0 0 toothpicks.