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

A381623 Triangle read by rows: 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 first person is eliminated, then two people are skipped, and then the process repeats.

Original entry on oeis.org

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

Views

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Mar 22 2025

Keywords

Comments

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

Crossrefs

Programs

  • Python
    def J(n,A):
        l=[]
        for i in range(n):
            l.append(i+1)
        index = 0
        P=[]
        for i in range(n):
            index+=A[i]
            index=index%len(l)
            P.append(l[index])
            l.pop(index)
        return P
    def invPerm(p):
        inv = []
        for i in range(len(p)):
            inv.append(None)
        for i in range(len(p)):
            inv[p[i]-1]=i+1
        return inv
    def DUU(n):
        return [0] + [2 for i in range(n)]
    seq = []
    for i in range(1,20):
        seq += J(i, DUU(i))
    print(", ".join([str(v) for v in seq]))
    
  • 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 + 2)%len(J)
        return out + [J[0]]
    print([e for n in range(1, 14) for e in row(n)]) # Michael S. Branicky, Mar 27 2025
Showing 1-1 of 1 results.