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 A383845 #14 Jun 15 2025 09:34:55 %S A383845 1,1,2,1,2,3,1,2,4,3,1,2,4,5,3,1,2,4,5,3,6,1,2,4,5,7,3,6,1,2,4,5,7,8, %T A383845 6,3,1,2,4,5,7,8,3,6,9,1,2,4,5,7,8,10,3,9,6,1,2,4,5,7,8,10,11,6,9,3,1, %U A383845 2,4,5,7,8,10,11,3,6,12,9,1,2,4,5,7,8,10,11,13,3,9,12,6 %N A383845 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 the elimination pattern is eliminate-eliminate-skip. %C A383845 This Josephus problem is related to down-down-under card dealing. %C A383845 The n-th row has n elements. %C A383845 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 first number, eliminates the second, then skips the third. 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 A383845 Consider 4 people in a circle. Initially, person number 1 is eliminated, person number 2 is eliminated, and person number 3 is skipped. The remaining people are now in order 4, 3. Then, both are eliminated. Thus, the fourth row of the triangle is 1, 2, 4, 3, the order of elimination. %e A383845 The triangle begins %e A383845 1; %e A383845 1, 2; %e A383845 1, 2, 3; %e A383845 1, 2, 4, 3; %e A383845 1, 2, 4, 5, 3; %e A383845 1, 2, 4, 5, 3, 6; %e A383845 1, 2, 4, 5, 7, 3, 6; %e A383845 1, 2, 4, 5, 7, 8, 6, 3; %o A383845 (Python) %o A383845 def row(n): %o A383845 i, J, out = 0, list(range(1, n+1)), [] %o A383845 while len(J) > 1: %o A383845 i = i%len(J) %o A383845 out.append(J.pop(i)) %o A383845 i = i%len(J) %o A383845 if len(J) > 1: %o A383845 out.append(J.pop(i)) %o A383845 i = (i + 1)%len(J) %o A383845 out += [J[0]] %o A383845 return out %o A383845 print([e for n in range(1, 14) for e in row(n)]) %Y A383845 Cf. A383846 (row end), A383847 (inverse permutation), A384753 (permutation order). %Y A383845 Cf. A006257, A001651. %K A383845 nonn,tabl %O A383845 1,3 %A A383845 _Tanya Khovanova_, _Nathan Sheffield_, and the MIT PRIMES STEP junior group, May 12 2025