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.

A381049 Triangle T(n,k) read by rows: where T(n,k) is the number of the k-th eliminated person in the variation of the Josephus elimination process for n people, where one person is skipped and two people are eliminated.

This page as a plain text file.
%I A381049 #16 May 04 2025 17:28:49
%S A381049 1,2,1,2,3,1,2,3,1,4,2,3,5,1,4,2,3,5,6,4,1,2,3,5,6,1,4,7,2,3,5,6,8,1,
%T A381049 7,4,2,3,5,6,8,9,4,7,1,2,3,5,6,8,9,1,4,10,7,2,3,5,6,8,9,11,1,7,10,4,2,
%U A381049 3,5,6,8,9,11,12,4,7,1,10,2,3,5,6,8,9,11,12,1,4,10,13,7
%N A381049 Triangle T(n,k) read by rows: where T(n,k) is the number of the k-th eliminated person in the variation of the Josephus elimination process for n people, where one person is skipped and two people are eliminated.
%C A381049 This Josephus problem is related to under-down-down card dealing.
%C A381049 The n-th row has n elements.
%C A381049 In this variation of the Josephus elimination process, the numbers 1 through n are arranged in a circle. A pointer starts at position 1. With each turn, the pointer skips one number and the next two numbers are eliminated. The process repeats until no numbers remain. This sequence represents the triangle T(n, k), where n is the number of people in the circle, and T(n, k) is the elimination order of the k-th number in the circle.
%e A381049 Consider 4 people in a circle. Initially, person number 1 is skipped and persons number 2 and 3 are eliminated. The remaining people are now in order 4, 1. Then 4 is skipped and 1 is eliminated. Then, 4 is eliminated. Thus, the fourth row of the triangle is 2, 3, 1, 4, the order of elimination.
%e A381049 Triangle begins;
%e A381049 1;
%e A381049 2, 1;
%e A381049 2, 3, 1;
%e A381049 2, 3, 1, 4;
%e A381049 2, 3, 5, 1, 4;
%e A381049 2, 3, 5, 6, 4, 1;
%e A381049 2, 3, 5, 6, 1, 4, 7;
%e A381049 2, 3, 5, 6, 8, 1, 7, 4;
%e A381049 2, 3, 5, 6, 8, 9, 4, 7, 1;
%o A381049 (Python)
%o A381049 def row(n):
%o A381049     i, J, out = 0, list(range(1, n+1)), []
%o A381049     while len(J) > 1:
%o A381049         i = (i + 1)%len(J)
%o A381049         out.append(J.pop(i))
%o A381049         i = i%len(J)
%o A381049         if len(J) > 1:
%o A381049             out.append(J.pop(i))
%o A381049     out += [J[0]]
%o A381049     return out
%o A381049 print([e for n in range(1, 14) for e in row(n)]) # _Michael S. Branicky_, Apr 28 2025
%Y A381049 Cf. A006257, A007494, A225381, A321298, A378635, A337191, A381048,  A381049.~
%K A381049 nonn,tabl
%O A381049 1,2
%A A381049 _Tanya Khovanova_, _Nathan Sheffield_, and the MIT PRIMES STEP junior group, Apr 14 2025