cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A238371 a(1)=1; for n > 1, a(n) = the number of "topped" Mongean shuffles to reorder a stack of n cards to its original order.

This page as a plain text file.
%I A238371 #25 Apr 01 2019 02:12:06
%S A238371 1,1,3,3,5,5,4,4,9,9,11,11,9,9,5,5,12,12,12,12,7,7,23,23,8,8,20,20,29,
%T A238371 29,6,6,33,33,35,35,20,20,39,39,41,41,28,28,12,12,36,36,15,15,51,51,
%U A238371 53,53,36,36,44,44,24,24,20,20,7,7,65,65,36,36,69,69,60,60,42,42,15,15,20,20,52,52,81,81,83,83,9,9,60,60
%N A238371 a(1)=1; for n > 1, a(n) = the number of "topped" Mongean shuffles to reorder a stack of n cards to its original order.
%C A238371 In the Mongean shuffle, the top card of the stack becomes the top of the new stack, the second of the old stack goes on top of the new stack, the third to the bottom of the new stack, alternating top and bottom of the new stack.
%C A238371 Here we define a shuffle where the top-bottom placements in the new stack alternate in the same way, but the second card of the old stack moves to the *bottom* of the stack.
%C A238371 A single shuffle is a permutation of 1, 2, 3, 4, 5, 6, ... -> ..., 7, 5, 3, 1, 2, 4, 6, ...
%C A238371 The fixed points, where n=a(n), seem to be in A163778.
%C A238371 (The "topped" classification is a nomenclature invented here, to be replaced if this variant appears elsewhere in the literature.)
%H A238371 Wikipedia, <a href="http://en.wikipedia.org/wiki/Shuffling#Mongean_shuffle">Mongean shuffle</a>
%F A238371 a(A163778(n)) = A163778(n). - _Andrew Howroyd_, Nov 11 2017
%p A238371 topMong := proc(L)
%p A238371     ret := [op(1,L)] ;
%p A238371     for k from 2 to nops(L) do
%p A238371         if type(k,'even') then
%p A238371             ret := [op(ret),op(k,L)] ;
%p A238371         else
%p A238371             ret := [op(k,L),op(ret)] ;
%p A238371         end if;
%p A238371     end do:
%p A238371     ret ;
%p A238371 end proc:
%p A238371 A238371 := proc(n)
%p A238371     local ca,org,tu ;
%p A238371     ca := [seq(k,k=1..n)] ;
%p A238371     org := [seq(k,k=1..n)] ;
%p A238371     for tu from 1 do
%p A238371         ca := topMong(ca) ;
%p A238371         if ca = org then
%p A238371             return tu;
%p A238371         end if:
%p A238371     end do:
%p A238371 end proc:
%p A238371 seq(A238371(n),n=2..88) ;
%t A238371 topMong[L_] := Module[{ret = {L[[1]]}}, For[k = 2, k <= Length[L], k++, If[ EvenQ[k], ret = Append[ret, L[[k]]], ret = Prepend[ret, L[[k]]]]]; ret];
%t A238371 A238371[n_] := Module[{ca, org, tu}, ca = org = Range[n]; For[tu = 1, True, tu++, ca = topMong[ca]; If[ca == org, Return[tu]]]];
%t A238371 Array[A238371, 88] (* _Jean-François Alcover_, Jul 03 2018, after _R. J. Mathar_ *)
%o A238371 (PARI) apply( A238371(n)=znorder(Mod(bitand(n,2)*2-2,n\2*4+3)), [0..99]) \\ _M. F. Hasler_, Mar 31 2019
%Y A238371 Cf. A019567 (Mongean shuffle), A294673 (a bisection).
%K A238371 nonn
%O A238371 1,3
%A A238371 _R. J. Mathar_, Feb 25 2014