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.

A381129 A version of the Josephus problem: a(n) is the surviving integer under the spelling version of the elimination process, called Down-SpellUnder.

This page as a plain text file.
%I A381129 #8 Feb 23 2025 11:29:25
%S A381129 1,2,2,3,3,2,7,8,4,6,4,6,7,11,10,3,14,4,17,11,3,16,7,16,7,22,2,8,24,
%T A381129 27,7,21,13,28,30,8,3,37,12,7,8,33,7,33,44,11,32,8,6,43,2,18,49,8,32,
%U A381129 54,26,43,44,30,40,52,26,44,8,27,60,16,11,61,70,14,58,55
%N A381129 A version of the Josephus problem: a(n) is the surviving integer under the spelling version of the elimination process, called Down-SpellUnder.
%C A381129 Arrange n people numbered 1, 2, 3, ..., n in a circle, increasing clockwise. Execute the person numbered 1, then spell the letters of O-N-E, moving one person clockwise for each letter. Once you are done, eliminate the next person. Then, spell the letters of T-W-O; in other words, skip three people and eliminate the next person. Following this, spell the letters of T-H-R-E-E; in other words, skip five people and eliminate the next person. Continue until one person remains. The number of this person is a(n).
%e A381129 Consider n = 4 people. The first person eliminated is number 1. This leaves the remaining people in the order 2, 3, 4. The second person eliminated is number 2; the people left are in the order 3, 4. The next person eliminated is numbered 4, leaving only the person numbered 3. Thus, a(4) = 3.
%o A381129 (Python)
%o A381129 from num2words import num2words as n2w
%o A381129 def f(n): return sum(1 for c in n2w(n).replace(" and", "") if c.isalpha())
%o A381129 def a(n):
%o A381129     c, i, J = 1, 0, list(range(1, n+1))
%o A381129     while len(J) > 1:
%o A381129         q = J.pop(i)
%o A381129         i = (i + f(c))%len(J)
%o A381129         c = c+1
%o A381129     return J[0]
%o A381129 print([a(n) for n in range(1, 75)]) # _Michael S. Branicky_, Feb 16 2025
%Y A381129 Cf. A005589, A006257, A225381, A321298, A378635, A380201, A380202, A380204, A380246, A380247, A380248, A381114, A381127, A381128.
%K A381129 nonn,word
%O A381129 1,2
%A A381129 _Tanya Khovanova_, _Nathan Sheffield_, and the MIT PRIMES STEP junior group, Feb 14 2025
%E A381129 a(22) and beyond from _Michael S. Branicky_, Feb 16 2025