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.
%I A381623 #15 Apr 05 2025 23:40:31 %S A381623 1,1,2,1,2,3,1,4,2,3,1,4,3,5,2,1,4,2,6,3,5,1,4,7,5,3,6,2,1,4,7,3,8,6, %T A381623 2,5,1,4,7,2,6,3,9,5,8,1,4,7,10,5,9,6,3,8,2,1,4,7,10,3,8,2,9,6,11,5,1, %U A381623 4,7,10,2,6,11,5,12,9,3,8,1,4,7,10,13,5,9,2,8,3,12,6,11 %N A381623 Triangle read by rows: T(n,k) is the number of the k-th eliminated person in the variation of the Josephus elimination process for n people, where the first person is eliminated, then two people are skipped, and then the process repeats. %C A381623 This variation of the Josephus problem is related to down-under-under card dealing. The n-th row has n elements. %C A381623 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 eliminates the number and then skips two numbers. 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 A381623 Consider 4 people in a circle. Initially, person number 1 is eliminated, and persons 2 and 3 are skipped. The remaining people are now in order 4, 2, 3. Then, person 4 is eliminated, and 2 and 3 are skipped. The remaining people are in order 2, 3. Now, person 2 is eliminated. Person 3 is eliminated last. Thus, the fourth row of the triangle is 1, 4, 2, 3. %e A381623 Triangle begins: %e A381623 1; %e A381623 1, 2; %e A381623 1, 2, 3,; %e A381623 1, 4, 2, 3; %e A381623 1, 4, 3, 5, 2; %e A381623 1, 4, 2, 6, 3, 5; %e A381623 1, 4, 7, 5, 3, 6, 2; %e A381623 1, 4, 7, 3, 8, 6, 2, 5; %e A381623 ... %o A381623 (Python) %o A381623 def J(n,A): %o A381623 l=[] %o A381623 for i in range(n): %o A381623 l.append(i+1) %o A381623 index = 0 %o A381623 P=[] %o A381623 for i in range(n): %o A381623 index+=A[i] %o A381623 index=index%len(l) %o A381623 P.append(l[index]) %o A381623 l.pop(index) %o A381623 return P %o A381623 def invPerm(p): %o A381623 inv = [] %o A381623 for i in range(len(p)): %o A381623 inv.append(None) %o A381623 for i in range(len(p)): %o A381623 inv[p[i]-1]=i+1 %o A381623 return inv %o A381623 def DUU(n): %o A381623 return [0] + [2 for i in range(n)] %o A381623 seq = [] %o A381623 for i in range(1,20): %o A381623 seq += J(i, DUU(i)) %o A381623 print(", ".join([str(v) for v in seq])) %o A381623 (Python) %o A381623 def row(n): %o A381623 i, J, out = 0, list(range(1, n+1)), [] %o A381623 while len(J) > 1: %o A381623 i = i%len(J) %o A381623 out.append(J.pop(i)) %o A381623 i = (i + 2)%len(J) %o A381623 return out + [J[0]] %o A381623 print([e for n in range(1, 14) for e in row(n)]) # _Michael S. Branicky_, Mar 27 2025 %Y A381623 Cf. A006257, A016777, A054995, A225381, A321298, A378635, A381622. %K A381623 nonn,tabl %O A381623 1,3 %A A381623 _Tanya Khovanova_, _Nathan Sheffield_, and the MIT PRIMES STEP junior group, Mar 22 2025