Big update! I think the new Claude 5 Fable model may potentially have solved this problem?
What follows is written by Claude:
The result
For p pairs, the number of turns T under perfect play takes values in \{p, \dots, 2p-1\}, and for w = 1, \dots, p-1:
P(T = p + w) \;=\; \frac{1}{(2p-1)!!}\sum_{n=1}^{\min(w,\,p-w)} \frac{(p+n)!}{n!\,(p-w-n)!}\sum_{\substack{j_1+\cdots+j_n = 2n+w\\ j_i \ge 3}}\;\prod_{i=1}^{n}\frac{2^{\,j_i-1}-2}{j_i!}
with P(T = p) = 1/(2p-1)!! as the w = 0 case. The inner sum runs over the ways of writing 2n+w as an ordered sum of n parts, each part at least 3. Everything is a finite sum of factorials and powers of 2, no recursion or DP left, closed-form in the same sense as the derangement formula. It reproduces every probability computed in this thread exactly, including @byorgey’s p = 6, 7, 8 rows from post 12.
It also settles the conjectures from posts 11 and 12:
- the (2p-1)!! denominators are real,
- P(T = 2p-1) = (2^p - 2)/(2p-1)!! (this is just the n = 1 term of the formula),
- the second column really is 2\binom{p+1}{3}, i.e. P(T = p+1) = \frac{(p-1)p(p+1)}{3\,(2p-1)!!}.
Worked example. p = 4, T = 6, so w = 2. The sum has two terms. For n=1, the only composition of 2n+w=4 into one part \ge 3 is (4), giving \frac{5!}{1!\,1!}\cdot\frac{2^3-2}{4!} = 30. For n=2, the only composition of 6 into two parts \ge 3 is (3,3), giving \frac{6!}{2!\,0!}\cdot\left(\frac{2^2-2}{3!}\right)^2 = 40. Total: \frac{30+40}{7!!} = \frac{70}{105} = \frac{2}{3}, matching the table. 
Proof sketch
This builds directly on @byorgey’s reformulation in post 10 (flip unknowns left to right, so the whole game is a deterministic function of the deal). Parse the deal into blocks: a card whose mate was already seen forms a 1-block, and a brand-new card grabs the next card to form a 2-block. The four possible block types are exactly the four possible turn outcomes (mate-known match, lucky match, “second card matches some other known card”, and two new cards), and chasing the turn accounting gives T = p + W, where W is the number of 2-blocks whose two cards differ.
Then a small miracle: the probability of any given block pattern is (number of ways the repeat-cards choose which open card they close) divided by (2p-1)!!, because all the other probability factors multiply to 2^p\,p! regardless of the order in which things happen. So computing the distribution of W reduces to a weighted counting problem. Lucky blocks decouple into a binomial coefficient, and the rest decomposes bijectively into independent components, one per “two new cards” turn: each such turn opens two chains of cards, and a component spanning j positions has internal weight 2^{j-1}-2. The exponential formula then assembles the pieces into the sum above.
Connections to the literature
It turns out this exact game has a small academic literature that this thread independently rediscovered chunks of:
- Velleman & Warrington, What to Expect in a Game of Memory (American Mathematical Monthly, 2013). They prove the obvious strategy is optimal, so “perfect play” is well-defined and is what everyone here assumed. (I also re-verified this by exact dynamic programming over all game states up to 120 pairs, including the sneaky option of a deliberately wasteful second flip: it never helps, not even by a tie.) Their main theorem: E[T] = (3 - 2\ln 2)\,p + \frac{7}{8} - 2\ln 2 + o(1).
- Which means @dreev’s regression in post 20, 1.6137060\,p - 0.51155, had already found 3 - 2\ln 2 = 1.6137056\ldots and \frac{7}{8} - 2\ln 2 = -0.5112944\ldots to about five decimal places without knowing it.
- Acan & Hitczenko, On a memory game and preferential attachment graphs (2014), proved that T is asymptotically normal (and, fun fact, that the block lengths match vertex degrees in a preferential attachment graph).
Neither paper gives the exact finite-p distribution, and the numerator triangle 1;\ 1, 2;\ 1, 8, 6;\ 1, 20, 70, 14;\ \ldots is not in OEIS, so as far as I can tell the closed form above is new.
Verification script
Full disclosure given post 40: This is written by Claude. This script is the antidote to confidently-derived-but-wrong: it verifies the formula independently, by literally playing the game on every one of the 113,400 essentially-distinct deals up to p = 5, and against @poisson’s recurrence from post 16 (with @byorgey’s correction from post 18) in exact rational arithmetic up to p = 14.