# No subject

Wouter Meeussen eu000949 at pophost.eunet.be
Sun Nov 15 12:51:47 CET 1998

```Neil,

don't tempt us :

>%C A035485 What about the sequence that tells at which step n appears on
top? It >begins 0,1,2,8,5,4,78(?),...
>

with apologies for the following Mathematica-Mandarin-dialect:

Table[Length[FixedPoint[riguy,{},SameTest->(#2[[1]]=== i &)]]/2,{i,2,38}]
Out[]=
{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}

(* I tried to go up to 64, but card '39' refuses to surface now for quite a
while *).

the function 'riguy' is :

riguy[deck_List]:=
Module[{le=Length[deck]},
Flatten[Transpose[
Reverse@
Partition[Flatten[{deck,le+1,le+2 }],le/2+1]
]]]

You could consider the 'relevant' part of the deck as a kind of triangular
table:

NestList[riguy,{},12]//ColumnForm
Out[]=

{},
{2, 1},
{3, 2, 4, 1},
{1, 3, 5, 2, 6, 4},
{6, 1, 4, 3, 7, 5, 8, 2},
{5, 6, 8, 1, 2, 4, 9, 3, 10, 7},
{9, 5, 3, 6, 10, 8, 7, 1, 11, 2, 12, 4},
{1, 9, 11, 5, 2, 3, 12, 6, 4, 10, 13, 8, 14, 7},
{4, 1, 10, 9, 13, 11, 8, 5, 14, 2, 7, 3, 15, 12, 16, 6},
{2, 4, 7, 1, 3, 10, 15, 9, 12, 13, 16, 11, 6, 8, 17, 5, 18, 14},
{16, 2, 11, 4, 6, 7, 8, 1, 17, 3, 5, 10, 18, 15, 14, 9, 19, 12, 20, 13},
{10, 16, 18, 2, 15, 11, 14, 4, 9, 6, 19, 7, 12, 8, 20, 1, 13, 17, 21, 3,
22, 5},
{12, 10, 8, 16, 20, 18, 1, 2, 13, 15, 17, 11, 21, 14, 3, 4, 22, 9, 5, 6,
23, 19, 24, 7}

As you can see, the implementation has a different start:
shuffle and output,
take that list, add the next two cards (based on the length of the input-list),
shuffle and output, ...
The relevant deck grows 0,2,4,8, .. of course.

The position of card "1" can be traced by:
Position[NestList[riguy,{},64],1];
Transpose[%][[2]]

Out[]=
{ 2,4,1,2,4,8,1,2,4,8,16,7,14,28,25,17,34,31,23,5,10,20,40,31,11,22,44,31,3,6,
12,24,48,27,54,35,70,63,47,13,26,52,17,34,68,43,86,75,51,1,2,4,8,16,32,64,
13,26,52,104,85,45,90,51}

Your definition should prepend a "1" as starting element.

wouter.

***************************************************
At 20:06 14-11-98 -0500, N. J. A. Sloane wrote:
>Dear Sequence Fans,
>I would like to draw your attention to an old problem
>that i think was invented by Richard Guy, and which could
>potentially produce several interesting sequences.
>
>Take an infinite deck of cards labeled 1,2,3,4,5,6,...
>At step n, pick up the top n cards and interlace them
>with the next n cards.  For example, after step 2 we have
>3,2,4,1,5,6,7,...
>and we pick up 3,2,4 and shuffle them in, getting
>1,3,5,2,6,4,7,8,9,...
>Do this for ever. The sequence below gives the
>sequence of cards that appear on top of the deck.
>It is conjectured that eventually every number appears on top of the deck.
>Many other sequences suggest themselves-
>What about the sequence that tells at which step n appears on top? It
begins 0,1,2,8,5,4,78(?),...
>Or the sequence that gives the top cards that are new: 1 2 3 6 5 9 4 ...
>Or the sequence telling when 1 reaches the top (0,3,7,...)
>and so on.
>I have not been able to locate any publication by Richard that mentions this.
>
>%I A035485
>%S A035485 1,2,3,1,6,5,9,1,4
>%N A035485 Card on top of deck at nth stage of Richard Guy's shuffling problem.
>%O A035485 0,2
>%K A035485 nonn,easy,nice,more
>%D A035485 David Gale's column, Mathematical Intelligencer, '91 or '92.
>%A A035485 njas, Clark Kimberling (ck6 at cedar.evansville.edu)
>%C A035485 At nth step, pick up top n cards and interlace them with the next n.
>%C A035485 Here is the deck after steps 0,1,2,3,4,5:
>%C A035485 1,2,3,4,5,6,7,...
>%C A035485 2,1,3,4,5,6,7,...
>%C A035485 3,2,4,1,5,6,7,...
>%C A035485 1,3,5,2,6,4,7,8,9,...
>%C A035485 6,1,4,3,7,5,8,2,9,10,...
>%C A035485 It is conjectured that eventually every number appears on top of
the deck.
>%C A035485 What about the sequence that tells at which step n appears on
top? It begins 0,1,2,8,5,4,78(?),...
>
>Neil Sloane
>
>
Dr. Wouter L. J. MEEUSSEN
w.meeussen.vdmcc at vandemoortele.be
eu000949 at pophost.eunet.be

```