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.

A381051 A version of the Josephus problem: a(n) is the surviving integer under the eliminate-skip-eliminate version of the elimination process.

Original entry on oeis.org

1, 2, 2, 2, 5, 5, 2, 8, 5, 2, 8, 5, 11, 8, 14, 11, 17, 14, 2, 17, 5, 20, 8, 23, 11, 26, 14, 2, 17, 5, 20, 8, 23, 11, 26, 14, 29, 17, 32, 20, 35, 23, 38, 26, 41, 29, 44, 32, 47, 35, 50, 38, 53, 41, 2, 44, 5, 47, 8, 50, 11, 53, 14, 56, 17, 59, 20, 62, 23, 65, 26, 68
Offset: 1

Views

Author

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

Keywords

Comments

This variation of the Josephus problem is related to down-under-down card dealing.

Examples

			Consider 4 people in a circle in order 1,2,3,4. In the first round, person 1 is eliminated, then person 2 is skipped, then person 3 is eliminated. Now people are in order 4,2. In the second round, person 4 is eliminated. The last person, person 2, is freed. Thus, a(4) = 2.
		

Crossrefs

Programs

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