# as David says, shuffle wisely

vdmcc w.meeussen.vdmcc at vandemoortele.be
Mon Nov 16 18:59:01 CET 1998

```hi all,
the position (and thus also the surfacing) of card c can be calculated
without explicitely constructing the deck as:
c=39;
m=0;k=If[EvenQ[c],c/2-1,(c-1)/2];
FixedPoint[(If[#<=  (k+(++m)),2#  , 2#-2(k+m-1)  -3] )&,c,
SameTest->(#2===  1  &)];m+k
Out[]=
13932
so "39" surfaces after 13932 shuffles.
this way it takes only 2.33 seconds to calculate.

The results for cards 1 to 100 are thus:
{"0",1,2,8,5,4,78,37,6,11,28,12,349,13,383,10,18,16,29,
17,33,210,14,133,32,60,19,106,57,20,48,26,21,35,97,
217,25,22,13932,863,205,54,30452,306,2591,40,44,39,
49,38,51,47,30, " 252992198 " ,  2253,101,112,246,402,119,
53,139,8743,2938,24808,116,902,3021,710,64,118,91,
140,627,296,326,165375,118727,55,149,682,111,198,46,
4135,95,519,193,2330,187,52,113,65,90,400,89,73,1671,177,1005}

where I inserted "0" for card 1 (after zero shuffles),
and Dave Gale's result " 252992198 " for card 54
(according to Warut Roonguthai 's mail).
This card 54 calculation would take me 12 h to check.

wouter.

w.meeussen.vdmcc at vandemoortele.be

vdmcc at vandemoortele.be
tel  +32 (0) 51 33 21 11
fax +32 (0) 51 33 21 75

```

More information about the SeqFan mailing list