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-2 of 2 results.

A051732 Number of rounds of shuffling required to restore a deck of n cards to its original order: shuffling is done by keeping first card, putting second at end of deck, keeping next, putting next at end and so on.

Original entry on oeis.org

1, 1, 2, 2, 3, 5, 6, 6, 4, 9, 4, 28, 10, 9, 14, 12, 5, 70, 18, 24, 10, 7, 210, 126, 110, 60, 26, 120, 9, 29, 30, 60, 6, 33, 308, 42, 60, 990, 30, 374, 27, 41, 60, 2618, 840, 840, 420, 1386, 24, 15, 50, 644, 840, 53, 18, 1386, 14, 13300, 2520, 1260, 55, 6930, 50, 60, 7
Offset: 1

Views

Author

Marie-Christine Haton (Marie-Christine.Haton(AT)loria.fr)

Keywords

Comments

From Andrew Howroyd, Nov 11 2017:(Start)
The shuffling process is the same as the 'deal one, skip one' method described in A289386 except that dealt cards are placed face up. With this variation the first card always remains the first card.
Equivalently, place the numbers 1..n-1 on a circle and cyclically mark the 2nd unmarked number until all numbers are marked. The sequence in which the numbers are marked defines a permutation. The order of this permutation is a(n). The numbers 1..n can also be used, but in that case the number 1 should be marked first.
(End)

Examples

			From _Andrew Howroyd_, Nov 11 2017: (Start)
a(6) = 5 because it takes 5 rounds of shuffling to return the cards to their original order as illustrated below:
1 2 3 4 5 6
1 3 5 2 6 4
1 5 6 3 4 2
1 6 4 5 2 3
1 4 2 6 3 5
1 2 3 4 5 6
(End)
		

Crossrefs

Programs

  • PARI
    P(n,i)={my(d=2*n+1-2*i); while(ds, k++; t=f(t)); if(s==t, k, 0)}
    CyclePoly(n,x)={my(q=0); for(i=1, n, my(l=Follow(i,j->P(n,j))); if(l,q+=x^l)); q}
    a(n)={my(q=CyclePoly(n,x), m=1); for(i=1,poldegree(q),if(polcoeff(q,i), m=lcm(m,i))); m} \\ Andrew Howroyd, Nov 11 2017

Formula

a(2^n+1) = n+1. - Ripatti A. (ripatti(AT)inbox.ru), Feb 04 2010
a(A163782(n)+1) = A163782(n). - Andrew Howroyd, Nov 11 2017

Extensions

Name clarified by Andrew Howroyd, Nov 11 2017

A161172 a(n) is the order (or period) of the "Yummie" permutation applied to a set of n objects.

Original entry on oeis.org

1, 2, 3, 3, 5, 5, 6, 7, 15, 20, 11, 24, 24, 14, 6, 28, 17, 120, 55, 180, 21, 18, 60, 42, 90, 153, 140, 429, 56, 152, 60, 70, 483, 3640, 180, 272, 72, 1260, 180, 252, 174, 1260, 36, 442, 1404, 660, 47, 496, 240, 481, 48, 98, 570, 572
Offset: 1

Views

Author

Colm Mulcahy, Jun 04 2009

Keywords

Comments

The Yummie permutation is done as follows. Start with a packet of n cards (numbered 1 to n from top to bottom), and deal them into two piles, first to a spectator (pile A), and then to yourself (pile B), saying "You, me," silently to yourself over and over. Then, pick up pile B and deal again, first to the spectator, thereby adding to the existing pile A, and then to yourself, forming a new pile B. Repeat, picking up the diminished pile B, and dealing "You, me" as before. Eventually, just one card remains in pile B; place it on top of pile A. The sequence of cards in pile A determines the Yummie permutation ("You, me" said fast sounds like "Yummie").

Examples

			a(9) = 15, because when the Yummie permutation is applied to {1,2,3,4,5,6,7,8,9} we get {6,2,4,8,9,7,5,3,1}, which corresponds to the product of a disjoint five cycle and a three cycle, and hence has order 15.
		

Crossrefs

Programs

  • PARI
    P(n,i)={if(i%2, n-(i\2), P(n\2, (n-i)\2+1))}
    Follow(s, f)={my(t=f(s), k=1); while(t>s, k++; t=f(t)); if(s==t, k, 0)}
    Cycles(n)={my(L=List()); for(i=1, n, my(k=Follow(i, j->P(n, j))); if(k, listput(L,k))); vecsort(Vec(L))}
    a(n)={lcm(Cycles(n))} \\ Andrew Howroyd, Apr 28 2020
Showing 1-2 of 2 results.