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.

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

This page as a plain text file.
%I A383846 #8 May 26 2025 17:17:09
%S A383846 1,2,3,3,3,6,6,3,9,6,3,9,6,12,9,15,12,18,15,3,18,6,21,9,24,12,27,15,3,
%T A383846 18,6,21,9,24,12,27,15,30,18,33,21,36,24,39,27,42,30,45,33,48,36,51,
%U A383846 39,54,42,3,45,6,48,9,51,12,54,15,57,18,60,21,63,24,66,27
%N A383846 A version of the Josephus problem: a(n) is the surviving integer under the eliminate-eliminate-skip version of the elimination process.
%C A383846 This variation of the Josephus problem is related to down-down-under card dealing.
%p A383846 Consider 4 people in a circle in order 1,2,3,4. In the first round, person 1 is eliminated, then person 2 is eliminated, then person 3 is skipped. Now people are in order 4,3. In the second round, person 4 is eliminated. The last person, person 3, is freed. Thus, a(4) = 3.
%o A383846 (Python)
%o A383846 def a(n):
%o A383846     i, J, out = 0, list(range(1, n+1)), []
%o A383846     while len(J) > 1:
%o A383846         J.pop(i)
%o A383846         i = i%len(J)
%o A383846         if len(J) > 1:
%o A383846             J.pop(i)
%o A383846         i = i%len(J)
%o A383846         i = (i + 1)%len(J)
%o A383846     return J[0]
%o A383846 print([a(n) for n in range(1, 73)])
%Y A383846 Cf. A006257, A383845, A383846, A001651, A383847, A337191, A381051.
%K A383846 nonn
%O A383846 1,2
%A A383846 _Tanya Khovanova_, _Nathan Sheffield_, and the MIT PRIMES STEP junior group, May 12 2025