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.

A380246 Elimination order of the first person in a variation of the Josephus problem, where the number of skipped people correspond to the number of letters in consecutive numbers, called SpellUnder-Down.

This page as a plain text file.
%I A380246 #17 Feb 23 2025 11:28:44
%S A380246 1,2,1,2,5,4,2,5,6,4,6,10,3,12,6,8,15,4,13,19,14,17,5,22,18,26,6,20,
%T A380246 13,17,19,23,7,25,21,31,22,32,8,31,38,20,29,9,27,18,43,10,15,50,37,20,
%U A380246 16,41,11,21,39,36,34,32,29,12,36,50,27,53,35,19,45,67,13,20,70,59,74,26,21,40,65,14,49,82,33,43,28,34,53,15
%N A380246 Elimination order of the first person in a variation of the Josephus problem, where the number of skipped people correspond to the number of letters in consecutive numbers, called SpellUnder-Down.
%C A380246 Arrange n people numbered 1,2,3,...,n in a circle, increasing clockwise. Starting with the person numbered 1, 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. a(n) is the order of elimination of the first person.
%e A380246 Consider n = 4 people. The first person eliminated is number 4. This leaves the remaining people in order 1, 2, 3. The second person eliminated is number 1. Thus, person number 1 is eliminated in the second round, implying that a(4) = 2.
%o A380246 (Python)
%o A380246 from num2words import num2words as n2w
%o A380246 def spell(n):
%o A380246     return sum(1 for c in n2w(n).replace(" and", "").replace(" ", "").replace(chr(44), "").replace("-", ""))
%o A380246 def nthRow(n):
%o A380246     l = []
%o A380246     for i in range(0,n):
%o A380246         l.append(0)
%o A380246     zp = 0
%o A380246     for j in range(1,n+1):
%o A380246         zc = 0
%o A380246         while zc <= spell(j):
%o A380246             if l[zp] == 0:
%o A380246                 zc += 1
%o A380246             zp += 1
%o A380246             zp = zp % n
%o A380246         l[zp-1] = str(j)
%o A380246     return l
%o A380246 l = []
%o A380246 for i in range(1,89):
%o A380246     l += [nthRow(i)[0]]
%o A380246 print(l)
%o A380246 (Python)
%o A380246 from num2words import num2words as n2w
%o A380246 def f(n): return sum(1 for c in n2w(n).replace(" and", "") if c.isalpha())
%o A380246 def a(n):
%o A380246     c, i, J = 1, 0, list(range(1, n+1))
%o A380246     while len(J) > 0:
%o A380246         i = (i + f(c))%len(J)
%o A380246         q = J.pop(i)
%o A380246         if q == 1: return c
%o A380246         c = c+1
%o A380246 print([a(n) for n in range(1, 89)]) # _Michael S. Branicky_, Feb 15 2025
%Y A380246 Cf. A005589, A006257, A225381, A321298, A378635, A380201, A380202, A380204, A380246, A380247, A380248.
%K A380246 nonn,word
%O A380246 1,2
%A A380246 _Tanya Khovanova_ and the MIT PRIMES STEP junior group, Jan 17 2025