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.

A386312 Numbers of people such that the last person is freed in the variant of the Josephus problem in which one person is skipped, then one is eliminated, then two people are skipped and one eliminated, then three people are skipped and so on.

Original entry on oeis.org

1, 7, 10, 12, 21, 25, 28, 235, 822, 24886, 99607, 101497, 107716, 5756103, 55480598
Offset: 1

Views

Author

Tanya Khovanova, Nathan Sheffield, and the MIT PRIMES STEP junior group, Aug 20 2025

Keywords

Comments

This sequence can also be described in terms of "AP dealing", in which one deals a deck of N cards into a new deck by moving one card to the bottom, dealing out the next card on top of the new deck, moving two cards to the bottom, etc. This sequence consists of all the deck sizes such that the bottom card of the deck moves to the top after AP dealing.
Numbers k such that A291317(k) = k.

Examples

			Suppose there are people 1,2,3,4,5,6,7 in a circle. We first skip one person and eliminate the next, leaving people in order 3,4,5,6,7,1. Now, we skip two people and eliminate the next, leaving 6,7,1,3,4. Now, we skip three and eliminate the next, leaving 4,6,7,1. Now, we skip four and eliminate the next, leaving 6,7,1. Now, we skip five and eliminate the next, leaving 6,7. Finally, we skip six and eliminate the next, leaving just 7. As the last person in the circle was freed, 7 belongs to this sequence.
		

Crossrefs

Programs

  • Python
    def F(n):
        c, i, J = 1, 0, list(range(1, n+1))
        while len(J) > 1:
            i = (i + c) % len(J)
            q = J.pop(i)
            c = c + 1
        return J[0]
    print([n for n in range(1, 100000) if F(n) == n])

Extensions

a(15) from Jinyuan Wang, Aug 31 2025