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.

This page as a plain text file.
%I A381051 #14 May 04 2025 17:28:07
%S A381051 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,
%T A381051 17,5,20,8,23,11,26,14,29,17,32,20,35,23,38,26,41,29,44,32,47,35,50,
%U A381051 38,53,41,2,44,5,47,8,50,11,53,14,56,17,59,20,62,23,65,26,68
%N A381051 A version of the Josephus problem: a(n) is the surviving integer under the eliminate-skip-eliminate version of the elimination process.
%C A381051 This variation of the Josephus problem is related to down-under-down card dealing.
%e A381051 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.
%o A381051 (Python)
%o A381051 def a(n):
%o A381051     i, J, out = 0, list(range(1, n+1)), []
%o A381051     while len(J) > 1:
%o A381051         i = i%len(J)
%o A381051         J.pop(i)
%o A381051         i = (i + 1)%len(J)
%o A381051         i = i%len(J)
%o A381051         if len(J) > 1:
%o A381051             J.pop(i)
%o A381051     return J[0]
%o A381051 print([a(n) for n in range(1, 73)]) # _Michael S. Branicky_, Apr 28 2025
%Y A381051 Cf. A006257, A032766, A225381, A321298, A378635, A381050, A383076.
%K A381051 nonn
%O A381051 1,2
%A A381051 _Tanya Khovanova_, _Nathan Sheffield_, and the MIT PRIMES STEP junior group, Apr 14 2025