Card Games: Concentration

This problem is based on the card game Concentration , otherwise known as the Memory Game .

Rules: Concentration is played with a deck of 2 n 2n cards. Any deck of cards composed of n n 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 2 2 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 n = 1729 n=1729 (the Hardy-Ramanujan number, in honour of the great mathematicians). Thus our deck is made up of 1729 1729 pairs, or 1729 × 2 = 3458 1729 \times 2=3458 cards.

The expected number of moves needed to eliminate all of the cards is E E . Calculate E E , rounded to 3 3 decimal places.

Extra Credit:

Generalise this result for any n n .

More Problems About Card Games:

Play Your Cards Right

Concentration (again)

War


The answer is 2789.586.

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.

2 solutions

Nicola Mignoni
Apr 27, 2019

Let E n , k E_{n,k} be the expected number of moves to end the game with n n pairs ( 2 n 2n cards in the deck) and k k known \textit{known} cards, where 0 k n 0 \leq k \leq n . By known \textit{known} I mean that if you flip card i i and j j , i j i \neq 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 E_{0,1}=E_{1,1}=1 and that E n , n = n E_{n,n}=n . We can write a recursive equation for E n , k 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 \displaystyle 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_4E_{n,k+2}

where p i p_i is the probability of end up in the respective state. In particular

  • State E n 1 , k E_{n-1,k} represent the case in which the player removes a pair of cards, not among the already known ones
  • State E n 1 , k 1 E_{n-1,k-1} represent the case in which the player removes a pair of cards, among the already known ones
  • State E n 1 , k + 1 E_{n-1,k}+1 represent the case in which the player flips an unknown card and than one of the known ones. The subsequent move is to remove the known pair.
  • State E n , k + 2 E_{n,k+2} represent the case in which the player flips two unknown cards.

With a bit of patience, it can be found that

p 1 = 2 ( n k ) ( 2 n k ) ( 2 n k 1 ) p 2 = k 2 n k p 3 = 2 ( n k ) k ( 2 n k ) ( 2 n k 1 ) p 4 = 4 ( n k ) ( n k 1 ) ( 2 n k ) ( 2 n k 1 ) p_1=\frac{2(n-k)}{(2n-k)(2n-k-1)} \\ p_2=\frac{k}{2n-k} \\ p_3=\frac{2(n-k)k}{(2n-k)(2n-k-1)} \\ \\ p_4=\frac{4(n-k)(n-k-1)}{(2n-k)(2n-k-1)}

You can check that i = 1 4 p i = 1 \displaystyle \sum_{i=1}^{4} p_i=1 . Hence, the final form of the equation is

E n , k = { 1 + 2 ( n k ) ( 2 n k ) ( 2 n k 1 ) [ ( k + 1 ) E n 1 , k + k ] + k 2 n k E n 1 , k 1 + 4 ( n k ) ( n k 1 ) ( 2 n k ) ( 2 n k 1 ) E n , k + 2 , for n > 1 , 1 , for n = 1 , k = { 0 , 1 } \displaystyle E_{n,k}=\begin{cases} 1+\frac{2(n-k)}{(2n-k)(2n-k-1)}[(k+1)E_{n-1,k}+k]+\frac{k}{2n-k}E_{n-1,k-1}+\frac{4(n-k)(n-k-1)}{(2n-k)(2n-k-1)}E_{n,k+2}, & \ \text{for} \ n>1, \\ 1, & \ \text{for} \ n=1, k=\{0,1\} \end{cases}

For a given n n , the expected number of moves to end the game is E n , 0 E_{n,0} . When n = 1729 n=1729 it can be computed (I used MATLAB) that

E 1729 , 0 = 33475 12 2789.586 \displaystyle E_{1729,0}=\frac{33475}{12} \approx \boxed{2789.586}

Frank Aiello
Nov 22, 2017

We have the following theorem:

The expected length of a game of Memory with 2 n 2n cards is:

( 3 2 ln 2 (3 - 2 \ln 2 ) n n + 7 8 \frac{7}{8} - 2 ln 2 2 \ln 2 + E n E_n , where E n E_n is an error term that approaches zero as n approaches infinity.

The statement of the theorem and its proof can be found here .

So we simply apply this theorem to obtain our answer.

The expected length of a game of Memory with 1729 pairs of cards is:

( 3 2 ln 2 (3 - 2 \ln 2 ) 1729 1729 + 7 8 \frac{7}{8} - 2 ln 2 2 \ln 2 \approx 2789.586

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...