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-10 of 11 results. Next

A051733 Numbers n such that A051732(n) = n-1.

Original entry on oeis.org

2, 3, 6, 7, 10, 15, 19, 27, 30, 31, 34, 42, 51, 54, 66, 70, 75, 82, 87, 90, 91, 99, 106, 114, 135, 147, 159, 174, 175, 187, 190, 195, 210, 211, 222, 231, 234, 246, 255, 262, 271, 274, 279, 282, 294, 307, 310, 327, 330, 331, 339, 351, 355, 379, 387, 394, 399, 411, 414
Offset: 1

Views

Author

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

Keywords

Crossrefs

Cf. A051732. Equals A217948(n)/2.

Programs

  • Mathematica
    (* v8 *) Select[Range[2,4000],Function[n,Sort[First[First[PermutationCycles@Join[Table[2r-1,{r,1,n}],Table[2r-2n,{r,n+1,2n}]]]]]==Range[2,2n-1]]] (* Olivier Gérard, Nov 08 2012 *)

A163782 a(n) is the n-th J_2-prime (Josephus_2 prime).

Original entry on oeis.org

2, 5, 6, 9, 14, 18, 26, 29, 30, 33, 41, 50, 53, 65, 69, 74, 81, 86, 89, 90, 98, 105, 113, 134, 146, 158, 173, 174, 186, 189, 194, 209, 210, 221, 230, 233, 245, 254, 261, 270, 273, 278, 281, 293, 306, 309, 326, 329
Offset: 1

Views

Author

Peter R. J. Asveld, Aug 05 2009

Keywords

Comments

Place the numbers 1..N (N>=2) on a circle and cyclically mark the 2nd unmarked number until all N numbers are marked. The order in which the N numbers are marked defines a permutation; N is a J_2-prime if this permutation consists of a single cycle of length N.
The resulting permutation can be written as p(m,N) = (2N+1-||2N+1-m||)/2 (1 <= m <= N), where ||x|| is the odd number such that x/||x|| is a power of 2. E.g., ||16||=1 and ||120||=15.
No formula is known for a(n): the J_2-primes have been found by exhaustive search (however, see the CROSS-REFERENCES). But we have: (1) N is J_2-prime iff p=2N+1 is a prime number and +2 generates Z_p^* (the multiplicative group of Z_p). (2) N is J_2-prime iff p=2N+1 is a prime number and exactly one of the following holds: (a) N == 1 (mod 4) and +2 generates Z_p^* but -2 does not, (b) N == 2 (mod 4) and both +2 and -2 generate Z_p^*.

Examples

			p(1,5)=3, p(2,5)=1, p(3,5)=5, p(4,5)=2 and p(5,5)=4.
So p=(1 3 5 4 2) and 5 is J_2-prime.
		

References

  • R. L. Graham, D. E. Knuth & O. Patashnik, Concrete Mathematics (1989), Addison-Wesley, Reading, MA. Sections 1.3 & 3.3.

Crossrefs

A163783 through A163800 for J_3- through J_20-primes.
Considered as sets, A163782 is the union of A163777 and A163779, it equals the difference of A054639 and A163780, and 2*a(n) results in A071642.

Programs

  • Java
    isJ2Prime(int n) { // for n > 1
      int count = 0, leader = 0;
      if (n % 4 == 1 || n % 4 == 2) { // small optimization
        do {
          leader = A025480(leader + n);
          count++;
        } while (leader != 0);
      }
      return count == n;
    } // Joe Nellis, Jan 27 2023
  • Mathematica
    lst = {};
    Do[If[IntegerQ[(2^n + 1)/(2 n + 1)] && PrimitiveRoot[2 n + 1] == 2,
    AppendTo[lst, n]], {n, 2, 10^5}]; lst (* Hilko Koning, Sep 21 2021 *)
  • PARI
    Follow(s,f)={my(t=f(s),k=1); while(t>s, k++; t=f(t)); if(s==t, k, 0)}
    ok(n)={my(d=2*n+1); n>1&&n==Follow(1,i->(d-((d-i)>>valuation(d-i, 2)))/2)}
    select(n->ok(n),[1..1000]) \\ Andrew Howroyd, Nov 11 2017
    
  • PARI
    forprime(p=5, 2000, if(znorder(Mod(2, p))==p-1, print1((p-1)/2, ", "))); \\ Andrew Howroyd, Nov 11 2017
    

Formula

a(n) = A071642(n+3)/2.

A384753 Order of the permutation of {1,...,n} formed by a Josephus elimination variation: take 2, skip 1.

Original entry on oeis.org

1, 1, 1, 2, 3, 3, 5, 6, 4, 7, 9, 10, 5, 9, 13, 70, 12, 15, 84, 70, 52, 42, 21, 30, 15, 16, 38, 84, 168, 24, 90, 360, 120, 27, 24, 72, 30, 108, 286, 276, 105, 4680, 198, 36, 630, 234, 120, 2856, 54, 1056, 532, 660, 51, 310, 406, 54, 420, 120, 55, 264, 150
Offset: 1

Views

Author

Chuck Seggelin, Jun 09 2025

Keywords

Comments

The Josephus elimination begins with a circular list {1,...,n} from which successively take 2 elements and skip 1, and the permutation is the elements taken in the order they're taken.
The same effect can be had by leaving remaining elements at the end of a flat list of {1,...,n} and applying the "skip" as a move (rotate) of the element at position 2*i+3 to the end of the list, for successive i >= 0.
Take 2 and move 1 is a move every 3rd element, but with the next 3 elements reckoned inclusive of the element which replaced the moved 1, and hence positions 2 apart.
A given element can be skipped or moved multiple times before reaching its final position.
The value of a(n) can vary sharply; for example, a(62) = 280, a(63) = 15939, a(64) = 210.

Examples

			For n=10, the rotations to construct the permutation are
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10
          \-----------------------/  1st rotation
    1, 2, 4, 5, 6, 7, 8, 9, 10, 3
                \-----------------/  2nd rotation
    1, 2, 4, 5, 7, 8, 9, 10, 3, 6
                      \-----------/  3rd rotation
    1, 2, 4, 5, 7, 8, 10, 3, 6, 9
                             \----/  4th rotation
    1, 2, 4, 5, 7, 8, 10, 3, 9, 6
The 4th rotate is an example of an element (6) which was previously rotated to the end, being rotated to the end again.
This final permutation has order a(10) = 7 (applying it 7 times reaches the identity permutation again).
		

Crossrefs

Cf. A051732 (Josephus elimination permutation order).

Programs

  • Python
    from sympy.combinatorics import Permutation
    def move_third(seq):
        for i in range(2,len(seq),2):
            seq.append(seq.pop(i))
        return seq
    def a(n):
        seq = list(range(n))
        p = move_third(seq.copy())
        return Permutation(p).order()

A217948 List of numbers 2n for which the riffle permutation permutes all except the first and last of the 2n cards.

Original entry on oeis.org

4, 6, 12, 14, 20, 30, 38, 54, 60, 62, 68, 84, 102, 108, 132, 140, 150, 164, 174, 180, 182, 198, 212, 228, 270, 294, 318, 348, 350, 374, 380, 390, 420, 422, 444, 462, 468, 492, 510, 524, 542, 548, 558, 564, 588, 614, 620, 654, 660, 662, 678, 702, 710, 758, 774, 788, 798
Offset: 1

Views

Author

N. J. A. Sloane, Nov 07 2012, based on an email message from Anthony C Robin

Keywords

Comments

With 2n cards, a riffle shuffle can be described as a permutation, where r becomes 2r-1 when r <= n and r becomes 2r-2n when r > n. The first and last cards are always left unaltered. Sequence A002326 describes the lengths of the longest orbits in the permutation. E.g. when 2n=10, the permutation can be described as (2,3,5,9,8,6)(4,7). The present sequence gives the values of 2n for which there is just one orbit on the 2n-2 cards, for example the permutation when 2n=12 is (2,3,5,9,6,11,10,8,4,7) containing all the 10 numbers other than 1 & 12.
Tiago Januario (email, Jan 12 2015; see also reference) conjectures that these terms are always one more than a prime. - N. J. A. Sloane, Mar 02 2015

References

  • Tiago Januario and Sebastian Urrutia, An Analytical Study in Connectivity of Neighborhoods for Single Round Robin Tournaments, 14th INFORMS Computing Society Conference, Richmond, Virginia, January 11-13, 2015, pp. 188-199; http://dx.doi.org/10.1287/ics.2015.0014
  • Tiago Januario, S Urrutia, D de Werra, Sports scheduling search space connectivity: A riffle shuffle driven approach, Discrete Applied Mathematics, Volume 211, 1 October 2016, Pages 113-120; http://dx.doi.org/10.1016/j.dam.2016.04.018

Crossrefs

Equals twice A051733.

Programs

  • Mathematica
    (* v8 *)  2*Select[Range[2,1000],Function[n,Sort[First[First[ PermutationCycles@Join[Table[2r-1,{r,1,n}],Table[2r-2n,{r,n+1,2n}]]]]]== Range[2,2n-1]]] (* Olivier Gérard, Nov 08 2012 *)

Formula

From Joerg Arndt, Dec 15 2012: (Start)
Apparently a(n) = A179194(n) - 1.
a(n) = 2 * A051733(n). (End)

A289386 Number of rounds of 'deal one, skip one' shuffling required to return a deck of n cards to its original order.

Original entry on oeis.org

1, 2, 3, 2, 5, 6, 5, 4, 6, 6, 15, 12, 12, 30, 15, 4, 17, 18, 10, 20, 21, 14, 24, 90, 63, 26, 27, 18, 66, 12, 210, 12, 33, 90, 35, 30, 110, 120, 120, 26, 41, 42, 105, 30, 45, 30, 60, 48, 120, 50, 42, 510, 53, 1680, 120, 1584, 57, 336, 276, 60, 2665, 720, 8415
Offset: 1

Views

Author

Andrew Warren, Jul 04 2017

Keywords

Comments

Origin unknown. First encountered by this author as part of an employment-interview question at Apple Inc, in early 2016.
While holding a deck of n cards:
1. Deal the top card from the deck onto the table ('deal one').
2. Move the next card from the top of the deck to the bottom of the deck ('skip one').
3. Repeat steps 1 and 2 until all cards are on the table. This is a round.
4. Pick up the deck from the table and repeat steps 1 through 3 until the deck is in its original order.
From Robert Israel, Jul 06 2017: (Start)
a(n) <= A000793(n).
a(n) divides n!.
Conjecture: a(n) < n for infinitely many n.
Conjecture: the set of n for which the permutation is a single n-cycle, and thus a(n) = n, has nonzero density. (End)
It appears that for n = 2^k and all m > n, a(n) <= a(m). - Andrew Warren, Jul 15 2017
a(2^(k+1)) / a(2^k) = A020513(k+2) at least for 1 <= k <= 30, according to the values computed by Andrew Warren. - Andrey Zabolotskiy, Apr 02 2018

Examples

			Cards are labeled 'A', 'B', 'C', etc. 'ABCD' is a deck with 'A' on top, 'D' on the bottom.
For n = 4:
Round 1:
Hand: ABCD    Table: [empty] - initial state of Round 1
Hand: BCD     Table: A       - Deal one
Hand: CDB     Table: A       - Skip one
Hand: DB      Table: CA      - Deal one
Hand: BD      Table: CA      - Skip one
Hand: D       Table: BCA     - Deal one
Hand: D       Table: BCA     - Skip one
Hand: [empty] Table: DBCA    - Deal one, end of Round 1
Round 2:
Hand: DBCA    Table: [empty] - Initial state of Round 2
Hand: BCA     Table: D       - Deal one
Hand: CAB     Table: D       - Skip one
Hand: AB      Table: CD      - Deal one
Hand: BA      Table: CD      - Skip one
Hand: A       Table: BCD     - Deal one
Hand: A       Table: BCD     - Skip one
Hand [empty]  Table: ABCD    - Deal one, end of Round 2
The deck of 4 cards is in its original order ('ABCD') after 2 rounds, so a(4) = 2.
		

Crossrefs

Cf. A000793, A051732 (variation with cards dealt face up), A020513, A051168.

Programs

  • C
    // see link
    
  • Maple
    F:= proc(n)
    local deck, table, i;
    deck:= [$1..n];
    table:= NULL;
    for i from 1 to n-1 do
      table:= deck[1],table;
      deck:= deck[[$3..nops(deck),2]];
    od:
    ilcm(op(map(nops,convert([deck[1],table],'disjcyc'))));
    end proc:
    map(F, [$1..100]); # Robert Israel, Jul 06 2017
  • Mathematica
    P[n_, i_] := Module[{d = 2i - 1}, While[d < n, d *= 2]; 2n - d];
    Follow[s_, f_] := Module[{t = f[s], k = 1}, While[t > s, k++; t = f[t]]; If[s == t, k, 0]];
    CyclePoly[n_, x_] := Module[{q = 0}, For[i = 1, i <= n, i++, l = Follow[i, P[n, #]&]; If[l != 0, q += x^l]]; q];
    a[n_] := Module[{q = CyclePoly[n, x], m = 1}, For[i = 1, i <= Exponent[q, x], i++, If[Coefficient[q, x, i] != 0, m = LCM[m, i]]]; m];
    Array[a, 60] (* Jean-François Alcover, Apr 09 2020, after Andrew Howroyd *)
  • PARI
    deal(v)=my(deck=List(v),new=List(),cutoff=4000+#v,i=1); while(#deck>=i, listput(new,deck[i]); if(i++>#deck, break); listput(deck, deck[i]); if(#deck>cutoff, deck=List(deck[i+1..#deck]); i=0); i++); Vecrev(new)
    ordered(v)=for(i=1,#v, if(v[i]!=i, return(0))); 1
    a(n)=my(v=[1..n],t=1); while(!ordered(v=deal(v)), t++); t \\ Charles R Greathouse IV, Jul 06 2017
    
  • PARI
    \\ alternative for larger n such as 2^n.
    P(n,i)=my(d=2*i-1); 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

A384989 Order of the permutation of [n] formed by a Josephus elimination variation: take 3, skip 1.

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 4, 4, 6, 10, 6, 8, 12, 11, 9, 10, 42, 15, 16, 52, 60, 120, 18, 30, 140, 99, 95, 28, 90, 660, 30, 28, 30, 30, 546, 336, 48, 420, 24, 765, 1680, 60, 308, 400, 66, 462, 418, 4830, 252, 1430, 468, 49, 42, 180, 1020, 52, 2310, 264, 1680, 340, 380
Offset: 1

Views

Author

Chuck Seggelin, Jun 14 2025

Keywords

Comments

The Josephus elimination begins with a circular list [n] from which successively take 3 elements and skip 1, and the permutation is the elements taken in the order they're taken.
The same effect can be had by leaving remaining elements at the end of a flat list of [n] and applying the "skip" as a move (rotate) of the element at position 3*i+4 to the end of the list, for successive i >= 0.
Take 3 and move 1 is a move every 4th element, but with the next 4 elements reckoned inclusive of the element which replaced the moved 1, and hence positions 3 apart.
A given element can be skipped or moved multiple times before reaching its final position.

Examples

			For n=11, the rotations to construct the permutation are
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
             \------------------------/  1st rotation
    1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 4
                      \---------------/  2nd rotation
    1, 2, 3, 5, 6, 7, 9, 10, 11, 4, 8
                                 \----/  3rd rotation
    1, 2, 3, 5, 6, 7, 9, 10, 11, 8, 4
The 3rd rotate is an example of an element (4) which was previously rotated to the end, being rotated to the end again.
This final permutation has order a(11) = 6 (applying it 6 times reaches the identity permutation again).
		

Crossrefs

Cf. A051732 (Josephus elimination permutation order), A384753 (take 2 skip 1 Josephus variation).

Programs

  • Python
    from sympy.combinatorics import Permutation
    def move_fourth(seq):
        for i in range(3,len(seq),3):
            seq.append(seq.pop(i))
        return seq
    def a(n):
        seq = list(range(n))
        p = move_fourth(seq.copy())
        return Permutation(p).order()

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

A333468 Length of the largest disjoint cycle of the permutation that results from the composition of first n circular shifts.

Original entry on oeis.org

1, 2, 2, 3, 5, 6, 3, 4, 9, 4, 7, 10, 9, 14, 4, 5, 7, 18, 8, 10, 7, 7, 14, 11, 6, 26, 12, 9, 29, 30, 5, 6, 33, 11, 21, 6, 11, 15, 22, 27, 41, 6, 17, 8, 8, 7, 22, 24, 15, 50, 28, 8, 53, 18, 22, 14, 25, 9, 15, 55, 14, 50, 6, 7, 65, 11, 19, 34, 69, 23, 35, 14, 22, 74, 10
Offset: 1

Views

Author

Richard Locke Peterson, Mar 22 2020

Keywords

Comments

Size of the largest part of the partition of n that is associated with the cycle structure of the permutation given by the permutation product (1)*(1,2)*(1,2,3)*...*(1,2,3,...n) after the product is rewritten as the product of disjoint cycles, where * means functional composition, and the permutations are written in cycle form.
Also see Circular shift on Wikipedia.
For n>1, a(n) is always greater than 1, since the given product can never be the identity permutation on the set {1,2,...,n}, which is the only permutation associated with the partition <1,1,...,1> (1 repeated n times).
Connections: The image of 1 in each resulting permutation appears to be the same as the numbers in A003602. The number of parts in the partition associated with each resulting permutation appear to match the numbers in A006694.
The LCM of all cycle lengths gives A051732(n+1). - Alois P. Heinz, Apr 08 2020

Examples

			For n=3, the permutation (1)*(1,2)*(1,2,3)=(1)*(2,3), which is associated with the partition <2,1> of 3. The size of the largest part is 2, so a(3)=2.
For n=11, the permutation (1)*(1,2)*..*(1,2,..11)=(1,2,7,5)*(3,4,8,10,11,6,9) when rewritten as the product of disjoint cycles, which is associated with the partition <7,4> of 11. The size of the largest part is 7, so a(11)=7.
		

Crossrefs

Programs

  • PARI
    Follow(s, f)={my(t=f(s), k=1); while(t>s, k++; t=f(t)); if(s==t, k, 0)}
    mkp(n)={my(v=vector(n,i,i)); for(k=1, n, my(t=v[1]); for(i=1, k-1, v[i]=v[i+1]); v[k]=t); v}
    a(n)={my(v=mkp(n), m=0); for(i=1, n, m=max(m, Follow(i, j->v[j]))); m} \\ Andrew Howroyd, Mar 27 2020

Formula

a(n) = n <=> n in { A163782 } union { 1 }. - Alois P. Heinz, Apr 08 2020

Extensions

Terms a(20) and beyond from Andrew Howroyd, Mar 27 2020

A384184 Order of the permutation of {0,...,n-1} formed by successively swapping elements at i and 2*i mod n, for i = 0,...,n-1.

Original entry on oeis.org

1, 2, 1, 4, 2, 2, 2, 8, 3, 4, 5, 4, 6, 4, 6, 16, 4, 6, 9, 8, 4, 10, 28, 8, 10, 12, 9, 8, 14, 12, 12, 32, 5, 8, 70, 12, 18, 18, 24, 16, 10, 8, 7, 20, 210, 56, 126, 16, 110, 20, 60, 24, 26, 18, 120, 16, 9, 28, 29, 24, 30, 24, 60, 64, 6, 10, 33, 16
Offset: 1

Views

Author

Mia Boudreau, May 29 2025

Keywords

Comments

a(2*n) = 2*a(n) since the cycle lengths of the permutation with size 2*n is effectively that of size n twice, doubled. Thus, the LCM/order is doubled.

Examples

			For n = 11, the permutation is {0,3,4,7,8,1,2,9,10,5,6} and it has order a(11) = 5.
		

Crossrefs

Programs

  • Python
    from sympy.combinatorics import Permutation
    def a(n):
       L = list(range(n))
       for i in range(n):
           if (j:= (i << 1) % n) != i:
               L[i],L[j] = L[j],L[i]
       return Permutation(L).order() # Darío Clavijo, Jun 05 2025

Formula

a(2*n) = 2*a(n).
a(2^n) = 2^n.
Conjecture: a(2^n + 2^x) = 2^n * (x-n) if x > n.
a(2^n - 1) = A003418(n-1).
s(2^n + 1) = A000027(n).
a(2*n - 1) = A051732(n).
a(A004626(n)) % 2 = 1.
a(A065119(n)) = n/3.
a(A001122(n)) = (n-1) / 2.
a(A155072(n)) = (n-1) / 4.
a(A001133(n)) = (n-1) / 6.
a(A001134(n)) = (n-1) / 8.
a(A001135(n)) = (n-1) / 10.
a(A225759(n)) = (n-1) / 16.

A384990 Order of the permutation of [n] formed by a Josephus elimination variation: take k, skip 1, with k starting at 1 and increasing by 1 after each skip.

Original entry on oeis.org

1, 1, 2, 2, 4, 5, 6, 7, 15, 9, 12, 11, 12, 13, 14, 60, 16, 70, 24, 88, 20, 60, 22, 23, 24, 25, 26, 27, 420, 29, 221, 31, 3465, 33, 285, 35, 840, 37, 38, 1040, 40, 41, 2618, 43, 44, 2520, 46, 546, 48, 594, 840, 644, 52, 696, 54, 2520, 56, 57, 58, 59, 60, 61, 62
Offset: 1

Views

Author

Chuck Seggelin, Jun 14 2025

Keywords

Comments

The Josephus elimination begins with a circular list [n] from which successively take k elements and skip 1 where k begins at 1 and monotonically increases after each skip, and the permutation is the elements taken in the order they're taken.
Take k and move 1 is a move every k-th element, but with the next k+1 elements reckoned inclusive of the element which replaced the moved 1, and hence positions k apart.
A given element can be skipped or moved multiple times before reaching its final position.
This sequence enters relatively lengthy stretches of linearity where a(n) = n-1 before entering stretches where it oscillates between n-1 and much larger values. This behavior is observed multiple times between a(1) and a(1000). It is unknown if this behavior continues to happen further into the sequence. For example: a(n)=n-1 for n=905 to 946, and the terms that follow are 9419588158802421600, 947, 224555, 949, 1582305192, 951, 226455, 953, etc.

Examples

			For n=10, the rotations to construct the permutation are
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10
       \--------------------------/  1st rotation (k=1)
    1, 3, 4, 5, 6, 7, 8, 9, 10, 2
          \-----------------------/  2nd rotation (k=2)
    1, 3, 5, 6, 7, 8, 9, 10, 2, 4
                \-----------------/  3rd rotation (k=3)
    1, 3, 5, 6, 8, 9, 10, 2, 4, 7
                          \-------/  4th rotation (k=4)
    1, 3, 5, 6, 8, 9, 10, 4, 7, 2
The 4th rotate is an example of an element (2) which was previously rotated to the end, being rotated to the end again.
This final permutation has order a(10) = 9 (applying it 9 times reaches the identity permutation again).
		

Crossrefs

Cf. A051732 (Josephus elimination permutation order), A384753 (take 2 skip 1 Josephus variation), A384989 (take 3 skip 1 Josephus variation).

Programs

  • Python
    from sympy.combinatorics import Permutation
    def apply_transformation(seq):
        step = 1
        i = step
        while i < len(seq):
            seq.append(seq.pop(i))
            step += 1
            i += step - 1
        return seq
    def a(n):
        seq = list(range(n))
        p = apply_transformation(seq.copy())
        return Permutation(p).order()
Showing 1-10 of 11 results. Next