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.

Showing 1-3 of 3 results.

A294673 Order of the "inside-out" permutation on 2n+1 letters.

Original entry on oeis.org

1, 3, 5, 4, 9, 11, 9, 5, 12, 12, 7, 23, 8, 20, 29, 6, 33, 35, 20, 39, 41, 28, 12, 36, 15, 51, 53, 36, 44, 24, 20, 7, 65, 36, 69, 60, 42, 15, 20, 52, 81, 83, 9, 60, 89, 60, 40, 95, 12, 99, 84, 66, 105, 28, 18, 37, 113, 30, 92, 119, 81, 36, 25, 8, 36, 131, 22, 135, 20, 30, 47, 60, 48, 116, 132, 100, 51, 155
Offset: 0

Views

Author

P. Michael Hutchins, Nov 06 2017

Keywords

Comments

The "inside-out" permutation (closely related to the Mongean shuffle, see A019567) sends (t_1, t_2, ..., t_{2n+1}) to (t_{n+1}, t_{n+2}, t_{n}, t_{n+3}, t_{n-1}, ..., t_1). For n = 0, 1, 2, 3, this is (1), (2,3,1), (3,4,2,5,1), (4,5,3,6,2,7,1), whose orders are respectively 1,3,5,4.
This is the odd bisection of A238371 and also the odd bisection of A003558 (see Joseph L. Wetherell's comment below).

Examples

			For n=2: Iterating the "inside-out" permutation of a string of length 2n+1=5:
12345
34251
25413
41532
53124
12345
...
which has order a(2) = 5.
		

Crossrefs

Programs

  • Magma
    f:=func;
    [f(n): n in [0..100]]; // Joseph L. Wetherell, Nov 12 2017
    
  • Magma
    [Order(Integers(4*n+3)!-2*(-1)^n): n in [0..100]]; // Joseph L. Wetherell, Nov 15 2017
  • Maple
    f:= proc(n)
      ilcm(op(map(nops,convert(map(op, [[n+1],seq([n+1+i,n+1-i],i=1..n)]),disjcyc))))
    end proc:
    map(f, [$0..100]); # Robert Israel, Nov 09 2017
  • Mathematica
    a[n_] := MultiplicativeOrder[-2(-1)^n, 4n+3];
    a /@ Range[0, 100] (* Jean-François Alcover, Apr 07 2020 *)
  • PARI
    Follow(s,f)={my(t=f(s),k=1); while(t>s, k++; t=f(t)); if(s==t, k, 0)}
    CyclePoly(n,x)={my(p=0); for(i=1, 2*n+1, my(l=Follow(i, j->n+1+(-1)^j*ceil((j-1)/2) )); if(l,p+=x^l)); p}
    a(n)={my(p=CyclePoly(n,x), m=1); for(i=1,poldegree(p),if(polcoeff(p,i), m=lcm(m,i))); m} \\ Andrew Howroyd, Nov 08 2017
    
  • PARI
    a(n)=znorder(Mod(if(n%2,2,-2),4*n+3)) \\ See Wetherell formula; Charles R Greathouse IV, Nov 15 2017
    

Formula

The permutation sends i (1 <= i <= 2n+1) to p(i) = n + 1 + f(i), where f(i) = (-1)^i*ceiling((i-1)/2).
a(n) = minimal k>0 such that p^k() = p^0().
a((A163778(n)-1)/2) = A163778(n). - Andrew Howroyd, Nov 11 2017.
From Joseph L. Wetherell, Nov 14 2017: (Start)
a(n) is equal to the order of multiplication-by-2 acting on the set of nonzero elements in (Z/(4n+3)Z), modulo the action of +-1. To be precise, identify i=1,2,...,2*n+1 with the odd representatives J=1,3,...,4*n+1 of this set, via the map J = 2*i-1. It is not hard to show that the induced permutation on the set of J values is given on integer representatives by J -> (4*n+3+J)/2 if i=(J+1)/2 is even and J -> (4*n+3-J)/2 if i=(J+1)/2 is odd. It follows that this induces the permutation J -> +-J/2 (mod 4*n+3), from which we immediately see that the order is as stated.
Note that the order of 2 acting on (Z/(4n+3)Z)/{+-1} is the same as the order of either 2 or -2 acting on (Z/(4n+3)Z), depending on which of these is a quadratic residue modulo 4n+3. Thus an equivalent (and often easier) way to compute a(n) is as the order of -2*(-1)^n acting on (Z/(4n+3)Z).
Among other things, the lower and upper bounds log_2(n) + 2 < a(n) <= 2*n+1 follow immediately.
(End)
It appears that the upper bound a(n) = 2n+1 occurs iff 2n+1 belongs to A163778 or equivalently iff n belongs to A294434. This almost (but not quite) follows from the above comments by Andrew Howroyd and Joseph L. Wetherell. - N. J. A. Sloane, Nov 16 2017

A019567 Order of the Mongean shuffle permutation of 2n cards: a(n) is least number m for which either 2^m + 1 or 2^m - 1 is divisible by 4n + 1.

Original entry on oeis.org

1, 2, 3, 6, 4, 6, 10, 14, 5, 18, 10, 12, 21, 26, 9, 30, 6, 22, 9, 30, 27, 8, 11, 10, 24, 50, 12, 18, 14, 12, 55, 50, 7, 18, 34, 46, 14, 74, 24, 26, 33, 20, 78, 86, 29, 90, 18, 18, 48, 98, 33, 10, 45, 70, 15, 24, 60, 38, 29, 78, 12, 84, 41, 110, 8, 84, 26, 134, 12, 46, 35, 36, 68, 146
Offset: 0

Views

Author

John Bullitt (metta(AT)world.std.com), N. J. A. Sloane and J. H. Conway

Keywords

Comments

Write down 1, then 2 to left, 3 to right, 4 to left, ..., getting [ 2n,2n-2,...,4,2,1,3,5,...,2n-1 ]; the sequence 2,3,6,4,6,10,14,5,18,10,12,21,26,9,... gives order of permutation sending 1 to 2n, 2 to 2n-2, ..., 2n to 2n-1.
Equivalently, the sequence 2,3,6,4,6,10,14,5,18,10,12,21,26,9,... gives the number of Mongean shuffles needed to return a deck of 2n cards (n=1,2,3,...) to its original order.
It appears that a(n) = order((-1)^(n+1)*2 in Z_{2n+1}) / f with f=1 when n==2 (mod 3) and for n = 0, 19, 21, 30,33, 52, 55, 61, 63, 70, ..., f=2 else. I don't know how to characterize the "exceptional" n's. - M. F. Hasler, Mar 31 2019

Examples

			Illustrating the initial terms:
   n  4n+1  2^m+1  2^m-1  m
   0    1            1    1
   1    5     5           2
   2    9     9           3
   3   13    5*13         6
   4   17     17          4
   5   21           3*21  6
   6   25   41*25        10
		

References

  • A. P. Domoryad, Mathematical Games and Pastimes, Pergamon Press, 1964; see pp. 134-135.
  • W. W. Rouse Ball, Mathematical Recreations and Essays, 11th ed. 1939, p. 311

Crossrefs

Programs

  • Maple
    A019567:=  proc(n)
        for m from 1 do
            if modp(2^m-1,4*n+1) =0 or modp(2^m+1,4*n+1)=0 then
                return m ;
            end if;
        end do;
    end proc: # N. J. A. Sloane, Jul 28 2007
  • Mathematica
    a[n_] := For[m=1, True, m++, If[AnyTrue[{-1, 1}, Divisible[2^m+#, 4n+1]&], Return[m]]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Aug 26 2019 *)
  • PARI
    A019567(n,z=Mod(2,4*n+1))=for(m=1,oo,bittest(5,lift(z^m+1))&&return(m)) \\ M. F. Hasler, Mar 31 2019

Formula

a(A163777(n)/2) = A163777(n). - Andrew Howroyd, Nov 11 2017

Extensions

Comments corrected by Mikko Nieminen, Jul 26 2007, who also provided the Domoryad reference
Definition edited by N. J. A. Sloane, Nov 09 2017

A238373 The number of "topped inward" shuffles to reorder a stack of n cards to its original order.

Original entry on oeis.org

3, 4, 2, 4, 7, 12, 9, 8, 21, 12, 15, 15, 30, 16, 30, 40, 35, 60, 21, 57, 24, 24, 90, 63, 27, 28, 12, 12, 31, 220, 33, 63, 180, 420, 37, 225, 39, 24, 182, 99, 60, 40, 306, 264, 195, 48, 49, 60, 51, 144, 306, 84, 462, 60, 264, 265, 180, 240, 35, 35, 63, 144, 612, 544, 67, 1012, 870, 84, 840, 72, 195, 264, 180, 312, 650, 1023, 79, 180, 81, 228, 63, 84, 1740, 783, 87, 88
Offset: 3

Views

Author

R. J. Mathar, Feb 25 2014

Keywords

Comments

Define a shuffle where the top of the old stack becomes the top of the new stack and is "marked" such that the 2nd, 3rd, 4th card of the old stack are placed right after, just before, right after, just before,... the position of the marked card in the new stack.
This permutes the numbers 1, 2, 3, 4, 5.. -> 1 -> 1,2 -> 3,1,2 -> 3,1,4,2 -> 3,5,1,4,2 etc. Compared to the shuffle in A238371, the odd numbers before the 1 and even numbers after the 1 appear in the opposite order, (old) labels growing inwards towards the (old) top card.
(The "topped inward" classification is a nomenclature invented here; to be replaced by a better name once available.)
The sequence shows how often this shuffle needs to be applied to let the re-shuffled stack return to its original 1, 2, 3,.. order.
Conjecture (equivalent to the Pfister comment in A216066): if the shuffle were defined again in inward order, but with the odd numbers to the left and the even numbers to the right, A003558 becomes the number of shuffles to return to original order.

Examples

			For n=5, the shuffle of 1,2,3,4,5 is 3,5,1,4,2 (1st shuffle), which becomes 1,2,3,4,5 (2nd shuffle, already original order), so a(5)=2
		

Programs

  • Maple
    trackIn := proc(L)
        local ret,po,k ;
        ret := [op(1,L)] ;
        po := 1 ;
        for k from 2 to nops(L) do
            if type(k,'even') then
                ret := [op(1..po,ret),op(k,L),op(po+1..nops(ret),ret)] ;
            else
                ret := [op(1..po-1,ret),op(k,L),op(po..nops(ret),ret)] ;
                po := po+1 ;
            end if;
        end do:
        ret ;
    end proc:
    A238373 := proc(n)
        local ca,org,tu ;
        ca := [seq(k,k=1..n)] ;
        org := [seq(k,k=1..n)] ;
        for tu from 1 do
            ca := trackIn(ca) ;
            if ca = org then
                return tu;
            end if:
        end do:
    end proc:
    seq(A238373(n),n=3..88)
Showing 1-3 of 3 results.