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.

A381049 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 one person is skipped and two people are eliminated.

Original entry on oeis.org

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

Views

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Apr 14 2025

Keywords

Comments

This Josephus problem is related to under-down-down 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 skips one number and the next two numbers are eliminated. 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 skipped and persons number 2 and 3 are eliminated. The remaining people are now in order 4, 1. Then 4 is skipped and 1 is eliminated. Then, 4 is eliminated. Thus, the fourth row of the triangle is 2, 3, 1, 4, the order of elimination.
Triangle begins;
1;
2, 1;
2, 3, 1;
2, 3, 1, 4;
2, 3, 5, 1, 4;
2, 3, 5, 6, 4, 1;
2, 3, 5, 6, 1, 4, 7;
2, 3, 5, 6, 8, 1, 7, 4;
2, 3, 5, 6, 8, 9, 4, 7, 1;
		

Crossrefs

Programs

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