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).
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, 21, 11, 31, 33, 34, 32, 35, 37, 31, 16, 33, 15, 41, 43, 17, 44, 18, 12, 47, 49, 50, 48, 51, 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
Offset: 1
Keywords
Examples
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.
Programs
-
Python
from itertools import count, islice def agen(): # generator of terms L, nextL, mink, cset = [1, 2], 3, 1, set() # cset is set of centers used while True: c, m = next((k, i) for k in count(mink) if k not in cset and (i:=L.index(k))>0) if len(L) < 2*m+1: L += list(range(nextL, 2*m+2)) nextL = 2*m+2 for i in range(m): L[i], L[i+m+1] = L[i+m+1], L[i] while mink in cset: mink += 1 yield L[0] cset.add(c) print(list(islice(agen(), 80))) # Michael S. Branicky, Jun 12 2025