This problem is based on the card game Concentration , otherwise known as the Memory Game .
Rules: Concentration is played with a deck of cards. Any deck of cards composed of pairs of identical cards can be used to play. The cards are shuffled around and put face down. The player can select two cards. If they match, both are removed from play. If not, they are flipped back into a face down position and the next move commences.The cards are removed from play if they match. The game ends when all pairs of cards have been correctly matched and removed from play.
If you want to have a go at playing it go ahead and try it here . In this problem, for simplicity, we shall only have one player (as in solitaire).
Let's demonstrate with an example. You pick cards and turn the first over. It is a
Hopefully, the next card will be the same. If not, both will have to be turned back over. It is a
It's the same! Both cards are eliminated from play.
Let (the Hardy-Ramanujan number, in honour of the great mathematicians). Thus our deck is made up of pairs, or cards.
The expected number of moves needed to eliminate all of the cards is . Calculate , rounded to decimal places.
Extra Credit:
Generalise this result for any .
More Problems About Card Games:
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.
Let E n , k be the expected number of moves to end the game with n pairs ( 2 n cards in the deck) and k known cards, where 0 ≤ k ≤ n . By known I mean that if you flip card i and j , i = j , this two cards become known, meaning that the player will remember their position.
It's trivial that E 0 , 1 = E 1 , 1 = 1 and that E n , n = n . We can write a recursive equation for E n , k :
E n , k = 1 + p 1 E n − 1 , k + p 2 E n − 1 , k − 1 + p 3 ( E n − 1 , k + 1 ) + p 4 E n , k + 2
where p i is the probability of end up in the respective state. In particular
With a bit of patience, it can be found that
p 1 = ( 2 n − k ) ( 2 n − k − 1 ) 2 ( n − k ) p 2 = 2 n − k k p 3 = ( 2 n − k ) ( 2 n − k − 1 ) 2 ( n − k ) k p 4 = ( 2 n − k ) ( 2 n − k − 1 ) 4 ( n − k ) ( n − k − 1 )
You can check that i = 1 ∑ 4 p i = 1 . Hence, the final form of the equation is
E n , k = { 1 + ( 2 n − k ) ( 2 n − k − 1 ) 2 ( n − k ) [ ( k + 1 ) E n − 1 , k + k ] + 2 n − k k E n − 1 , k − 1 + ( 2 n − k ) ( 2 n − k − 1 ) 4 ( n − k ) ( n − k − 1 ) E n , k + 2 , 1 , for n > 1 , for n = 1 , k = { 0 , 1 }
For a given n , the expected number of moves to end the game is E n , 0 . When n = 1 7 2 9 it can be computed (I used MATLAB) that
E 1 7 2 9 , 0 = 1 2 3 3 4 7 5 ≈ 2 7 8 9 . 5 8 6