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.

A384908 Start with a list L of positive integers. At each step n, let the center be the smallest number that has not been used as a center before with index m > 1. For all i < m, swap L(i) with L(i+m). a(n) = L(1).

This page as a plain text file.
%I A384908 #17 Jun 18 2025 19:17:36
%S A384908 3,4,2,5,7,1,3,9,11,4,12,6,16,15,17,5,12,19,21,8,20,23,25,10,24,27,23,
%T A384908 21,11,31,33,34,32,35,37,31,16,33,15,41,43,17,44,18,12,47,49,50,48,51,
%U A384908 53,47,49,55,57,50,22,59,61,26,60,29,64,66,61,67,69,70,68,65,72,28,64,75,54,27,78,80,56
%N A384908 Start with a list L of positive integers. At each step n, let the center be the smallest number that has not been used as a center before with index m > 1. For all i < m, swap L(i) with L(i+m). a(n) = L(1).
%e A384908 Start with 1,2,3,4,5,6,.. The first number with index > 1 that has not been used as a center is 2, so it becomes the center and the list becomes 3,2,1,4,5,6.. and a(1) = 3. Now, the center is 1 and the list becomes 4,5,1,3,2,6,7.. and a(n) = 4. Now, the center is 3 (since 1 has already been used as a center) and the list becomes 2,6,7,3,1,5,4,8,9.. and a(n) = 2, and so on.
%o A384908 (Python)
%o A384908 from itertools import count, islice
%o A384908 def agen(): # generator of terms
%o A384908     L, nextL, mink, cset = [1, 2], 3, 1, set() # cset is set of centers used
%o A384908     while True:
%o A384908         c, m = next((k, i) for k in count(mink) if k not in cset and (i:=L.index(k))>0)
%o A384908         if len(L) < 2*m+1:
%o A384908             L += list(range(nextL, 2*m+2))
%o A384908             nextL = 2*m+2
%o A384908         for i in range(m):
%o A384908             L[i], L[i+m+1] = L[i+m+1], L[i]
%o A384908         while mink in cset:
%o A384908             mink += 1
%o A384908         yield L[0]
%o A384908         cset.add(c)
%o A384908 print(list(islice(agen(), 80))) # _Michael S. Branicky_, Jun 12 2025
%K A384908 nonn
%O A384908 1,1
%A A384908 _Ali Sada_, Jun 12 2025