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.

A386305 Numbers of people such that the first 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.

This page as a plain text file.
%I A386305 #78 Aug 31 2025 08:58:29
%S A386305 1,2,3,18,22,171,195,234,1262,2136,6040,42545,353067,1332099,1447753,
%T A386305 2789475,3635021,7857445,9224024,17128159,27666710,29279638
%N A386305 Numbers of people such that the first 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.
%C A386305 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 top card remains the same after AP dealing.
%C A386305 Numbers k such that A291317(k) = 1.
%e A386305 Suppose there are 5 people in a circle. We start with skipping one person and eliminating the next (person number 2). The leftover people are 3,4,5,1 in order. Then we skip two people and eliminate person number 5. The leftover people are 1,3,4 in order. Then we skip three people and person number 1 is eliminated. The leftover people are 3,4 in order. Then we skip four people and eliminate person number 3. Person 4 is freed. As person 1 is not freed, 5 is NOT in this sequence.
%o A386305 (Python)
%o A386305 def F(n):
%o A386305     c, i, J = 1, 0, list(range(1, n+1))
%o A386305     while len(J) > 1:
%o A386305         i = (i + c) % len(J)
%o A386305         q = J.pop(i)
%o A386305         c = c + 1
%o A386305     return J[0]
%o A386305 print([n for n in range(1, 100000) if F(n) == 1])
%Y A386305 Cf. A081614, A291317, A385328, A386312, A386643.
%K A386305 nonn,more,new
%O A386305 1,2
%A A386305 _Tanya Khovanova_, _Nathan Sheffield_, and the MIT PRIMES STEP junior group, Aug 20 2025
%E A386305 a(20)-a(22) from _Jinyuan Wang_, Aug 31 2025