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 A382355 #10 Apr 05 2025 23:25:37 %S A382355 1,1,1,4,3,6,3,6,9,3,6,9,12,1,4,7,10,13,16,19,1,4,7,10,13,16,19,22,25, %T A382355 28,31,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,4,7,10,13,16,19,22, %U A382355 25,28,31,34,37,40,43,46,49,52,55,58,61,64,67,70,3,6 %N A382355 A version of the Josephus problem: a(n) is the surviving integer under the skip-eliminate-skip version of the elimination process. %C A382355 This variation of the Josephus problem is related to under-down-under card dealing. %e A382355 Consider 4 people in a circle in order 1,2,3,4. In the first round, person 1 is skipped, then person 2 is eliminated, then person 3 is skipped. Now people are in order 4,1,3. In the second round, person 4 is skipped, person 1 is eliminated, and person 3 is skipped. Now people are in order 4,3. In the third round person 3 is eliminated. Person 4 is freed. Thus, a(4) = 4. %o A382355 (Python) %o A382355 def J(n,A): %o A382355 l=[] %o A382355 for i in range(n): %o A382355 l.append(i+1) %o A382355 index = 0 %o A382355 P=[] %o A382355 for i in range(n): %o A382355 index+=A[i] %o A382355 index=index%len(l) %o A382355 P.append(l[index]) %o A382355 l.pop(index) %o A382355 return P %o A382355 def invPerm(p): %o A382355 inv = [] %o A382355 for i in range(len(p)): %o A382355 inv.append(None) %o A382355 for i in range(len(p)): %o A382355 inv[p[i]-1]=i+1 %o A382355 return inv %o A382355 def survivor(n, A): %o A382355 return J(n, A)[n-1] %o A382355 def UDU(n): %o A382355 return [1] + [2 for i in range(n)] %o A382355 seq = [] %o A382355 for i in range(1,20): %o A382355 seq += [survivor(i, UDU(i))] %o A382355 print(", ".join([str(v) for v in seq])) %o A382355 (Python) %o A382355 def a(n): %o A382355 c, i, J = 1, 0, list(range(1, n+1)) %o A382355 while len(J) > 1: %o A382355 i = (i + 1)%len(J) %o A382355 q = J.pop(i) %o A382355 i = (i + 1)%len(J) # skip the third %o A382355 return J[0] %o A382355 print([a(n) for n in range(1, 73)]) # _Michael S. Branicky_, Mar 24 2025 %Y A382355 Cf. A006257, A225381, A321298, A378635, A382354, A382356, A382358. %K A382355 nonn %O A382355 1,4 %A A382355 _Tanya Khovanova_, _Nathan Sheffield_, and the MIT PRIMES STEP junior group, Mar 22 2025