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 A342101 #30 Aug 05 2021 13:18:39 %S A342101 1,2,3,1,3,1,2,1,3,1,2,3,1,1,2,1,3,1,2,3,1,3,1,2,1,1,2,3,1,1,2,1,3,1, %T A342101 2,3,1,3,1,2,1,3,1,2,3,1,1,2,1,1,2,3,1,3,1,2,1,1,2,3,1,1,2,1,3,1,2,3, %U A342101 1,3,1,2,1,3,1,2,3,1,1,2,1,3,1,2,3,1,3 %N A342101 Remove middle term and append, starting with [1, 2, 3]. %H A342101 Alois P. Heinz, <a href="/A342101/b342101.txt">Table of n, a(n) for n = 1..65537</a> %H A342101 Kevin Ryde, <a href="https://user42.tuxfamily.org/seq-A342101-middle-delete/index.html">PARI/GP Code and Notes</a>. %e A342101 Start with [1, 2, 3], take that sequence, remove the middle term, 2, and append to the original sequence, yielding [1, 2, 3, 1, 3]. Then repeat this process to give [1, 2, 3, 1, 3, 1, 2, 1, 3], and so on. %p A342101 T:= proc(n) option remember; `if`(n=1, [$1..3][], %p A342101 subsop(2^(n-2)+1=[][], [seq(T(i), i=1..n-1)])[]) %p A342101 end: %p A342101 seq(T(n), n=1..8); # _Alois P. Heinz_, Apr 12 2021 %t A342101 Nest[Join[#, Drop[#, {(Length[#] + 1)/2}]] &, Range[3], 6] (* _Michael De Vlieger_, May 01 2021 *) %o A342101 (Kotlin) %o A342101 fun A342101(iter: Int): List<Int> = removeMiddle(listOf(1,2,3), iter) %o A342101 fun removeMiddle(initial: List<Int>, iter: Int): List<Int> { %o A342101 if (iter < 2) return initial %o A342101 val prev = removeMiddle(initial, iter-1) %o A342101 return prev + prev.subList(0, (prev.size - 1) / 2) + prev.subList((prev.size + 1) /2, prev.size) %o A342101 } %o A342101 (Python) %o A342101 def aupton(terms): %o A342101 alst = [1, 2, 3] %o A342101 while len(alst) < terms: %o A342101 alst += alst[:len(alst)//2] + alst[(len(alst)+1)//2:] %o A342101 return alst[:terms] %o A342101 print(aupton(87)) # _Michael S. Branicky_, Mar 26 2021 %o A342101 (PARI) first(n) = { my(v = [1,2,3]); for(i = 1, logint(n-1, 2), cv = v[^(#v + 1)\2]; v = concat(v, cv) ); v } \\ _David A. Corneth_, Apr 14 2021 %o A342101 (PARI) \\ Also see links. %Y A342101 Cf. A000051. %K A342101 nonn %O A342101 1,2 %A A342101 _Matthew Malone_, Feb 28 2021