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

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()

A383845 Triangle T(n,k) read by rows: where T(n,k) is the number of the k-th eliminated person in the variation of the Josephus elimination process for n people, where the elimination pattern is eliminate-eliminate-skip.

Original entry on oeis.org

1, 1, 2, 1, 2, 3, 1, 2, 4, 3, 1, 2, 4, 5, 3, 1, 2, 4, 5, 3, 6, 1, 2, 4, 5, 7, 3, 6, 1, 2, 4, 5, 7, 8, 6, 3, 1, 2, 4, 5, 7, 8, 3, 6, 9, 1, 2, 4, 5, 7, 8, 10, 3, 9, 6, 1, 2, 4, 5, 7, 8, 10, 11, 6, 9, 3, 1, 2, 4, 5, 7, 8, 10, 11, 3, 6, 12, 9, 1, 2, 4, 5, 7, 8, 10, 11, 13, 3, 9, 12, 6
Offset: 1

Views

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, May 12 2025

Keywords

Comments

This Josephus problem is related to down-down-under card dealing.
The n-th row has n elements.
In this variation of the Josephus elimination process, the numbers 1 through n are arranged in a circle. A pointer starts at position 1. With each turn, the pointer eliminates the first number, eliminates the second, then skips the third. The process repeats until no numbers remain. This sequence represents the triangle T(n, k), where n is the number of people in the circle, and T(n, k) is the elimination order of the k-th number in the circle.

Examples

			Consider 4 people in a circle. Initially, person number 1 is eliminated, person number 2 is eliminated, and person number 3 is skipped. The remaining people are now in order 4, 3. Then, both are eliminated. Thus, the fourth row of the triangle is 1, 2, 4, 3, the order of elimination.
The triangle begins
  1;
  1, 2;
  1, 2, 3;
  1, 2, 4, 3;
  1, 2, 4, 5, 3;
  1, 2, 4, 5, 3, 6;
  1, 2, 4, 5, 7, 3, 6;
  1, 2, 4, 5, 7, 8, 6, 3;
		

Crossrefs

Cf. A383846 (row end), A383847 (inverse permutation), A384753 (permutation order).

Programs

  • Python
    def row(n):
        i, J, out = 0, list(range(1, n+1)), []
        while len(J) > 1:
            i = i%len(J)
            out.append(J.pop(i))
            i = i%len(J)
            if len(J) > 1:
                out.append(J.pop(i))
            i = (i + 1)%len(J)
        out += [J[0]]
        return out
    print([e for n in range(1, 14) for e in row(n)])

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()

A384991 Order of the permutation of [n] formed by a Josephus elimination variation: take p, skip 1, with p starting at 2 and advancing to the next prime after each skip.

Original entry on oeis.org

1, 1, 2, 3, 3, 5, 4, 7, 8, 15, 10, 11, 12, 13, 45, 15, 105, 17, 77, 19, 24, 21, 117, 23, 504, 255, 26, 165, 28, 440, 60, 31, 442, 33, 1386, 805, 154, 37, 105, 39, 1020, 216, 208, 43, 40, 45, 2860, 1953, 90, 49, 45, 51, 1092, 120, 184, 55, 56, 150, 58, 6045
Offset: 1

Views

Author

Chuck Seggelin, Jun 14 2025

Keywords

Comments

The Josephus elimination begins with a circular list [n] from which successively take p elements and skip 1 where p begins at 2 and increases to the next prime (3,5,7,11,13,...) after each skip, and the permutation is the elements taken in the order they're taken.
Let p(k) be the k-th prime number, and let k increment with each move. In this variation, "take p(k), skip 1" means: move the p(k)-th element to the end of the list. After each move, counting begins from the element that replaced the moved one, and the next move targets the subsequent p(k+1)-th element. Thus, the positions of the elements being moved are p(k+1)-1 apart.
That is, the moved positions follow this progression:
Position Moved Differences Between Positions
=================== =============================
2 - 1 = 1 1 - 0 = 1 (= 2 - 1)
(1) + 3 - 1 = 3 3 - 1 = 2 (= 3 - 1)
(3) + 5 - 1 = 7 7 - 3 = 4 (= 5 - 1)
(7) + 7 - 1 = 13 13 - 7 = 6 (= 7 - 1)
(13) + 11 - 1 = 23 23 - 13 = 10 (= 11 - 1)
^^ . ^^ .
p(k) . p(k)-1 .
. .
A given element can be moved multiple times before reaching its final position.

Examples

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

Crossrefs

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

Programs

  • Python
    from sympy.combinatorics import Permutation
    from sympy import isprime, prime
    def apply_transformation(seq):
        k = 1
        p = prime(k)
        i = p - 1
        while i < len(seq):
            seq.append(seq.pop(i))
            k += 1
            p = prime(k)
            i += (p-1)
        return seq
    def a(n):
        seq = list(range(n))
        p = apply_transformation(seq.copy())
        return Permutation(p).order()
Showing 1-4 of 4 results.