In a queue of xxxxdxxxxxx, left to right is top to bottom. X is the number of cards before d, Y is the number of cards after. Denote the queue as Q(X,Y). Repetitively do this operation: Shift 1 card to bottom, then remove the top card.
Question: After enough repititions of the operation, how do we know if d will be the only survivor in queue? If d survives, we say Q(X,Y) is true. Else we say Q(X,Y) is false.
==========
Case A: Y=0. So the queue is Q(X,0), or xxxxxxd. First, X must be even number. Otherwise d is kicked out very soon. After some repititions, queue becomes dxxx. Then an extra repition makes it xxd, back to the original form of Q(X,0), only that new X is shorter. The new X = (old X)/2-1.
As operations are repeated, ultimately X becomes 0. This means there is a number series in the form of:
X(i)=(X(i-1)+1)*2, where X(0)=0. This results in a series of: 0, 2, 6, 14, 30, ...
Rule A: given any queue form of Q(X,0), if X is equal to one member of the above series, then Q(X,0) is true. For example, Q(2,0), Q(6,0), Q(14,0) are all true.
========
Case B: Y=/=0, so the queue is Q(X,Y), or xxxxdx. First, X must be even number. Otherwise d is kicked out soon. After some repitition, queue becomes: dxxx. Then an extra repition makes it xxd, back to the original form of Q(Z,0), where Z= X/2+Y-1. Then we can use rule A to judge whether Q(Z, 0) is true.
Rule B: given any queue form of Q(X,Y), it will transform to Q(Z,0), where Z= X/2+Y-1.
===========
In the magic show, there are two cases: xxdxx, xxxxdx.
Case 1: xxdxx. Q(2,2) ==> Q(2,0)
Case 2: xxxxdx. Q(4,1) ==>Q(2,0)
Both are true.