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 A237126 #41 May 06 2025 21:52:55 %S A237126 0,1,4,2,9,7,6,3,16,25,14,17,12,13,8,5,26,61,36,115,22,47,27,67,20,41, %T A237126 21,43,15,23,10,11,38,119,81,359,51,179,146,791,33,91,64,247,39,121, %U A237126 88,407,31,83,57,221,32,89,59,227,24,53,34,97,18,29,19,37,54 %N A237126 a(0)=0, a(1) = 1, a(2n) = nonludic(a(n)), a(2n+1) = ludic(a(n)+1), where ludic = A003309, nonludic = A192607. %C A237126 Shares with permutation A237056 the property that the other bisection consists of only ludic numbers and the other bisection of only nonludic numbers. However, instead of placing terms in those subsets in monotone order this sequence recursively permutes the order of both subsets with the emerging permutation itself, so this is a kind of "deep" variant of A237056. %C A237126 Alternatively, this can be viewed as yet another "entanglement permutation", where two pairs of complementary subsets of natural numbers are entangled with each other. In this case a complementary pair odd/even numbers (A005408/A005843) is entangled with a complementary pair ludic/nonludic numbers (A003309/A192607). %H A237126 Antti Karttunen, <a href="/A237126/b237126.txt">Table of n, a(n) for n = 0..574</a> %H A237126 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A237126 a(0)=0, a(1) = 1, a(2n) = nonludic(a(n)), a(2n+1) = ludic(a(n)+1), where ludic = A003309, nonludic = A192607. %e A237126 a(2) = a(2*1) = nonludic(a(1)) = A192607(1) = 4. %e A237126 a(3) = a(2*1+1) = ludic(a(1)+1) = A003309(1+1) = A003309(2) = 2. %e A237126 a(4) = a(2*2) = nonludic(a(2)) = A192607(4) = 9. %e A237126 a(5) = a(2*2+1) = ludic(a(2)+1) = A003309(4+1) = A003309(5) = 7. %t A237126 nmax = 64; %t A237126 T = Range[2, 20 nmax]; %t A237126 L = {1}; %t A237126 While[Length[T] > 0, With[{k = First[T]}, %t A237126 AppendTo[L, k]; T = Drop[T, {1, -1, k}]]]; %t A237126 nonL = Complement[Range[Last[L]], L]; %t A237126 a[n_] := a[n] = Which[ %t A237126 n < 2, n, %t A237126 EvenQ[n] && a[n/2] <= Length[nonL], nonL[[a[n/2]]], %t A237126 OddQ[n] && a[(n-1)/2]+1 <= Length[L], L[[a[(n-1)/2]+1]], %t A237126 True, Print[" error: n = ", n, " size of T should be increased"]]; %t A237126 Table[a[n], {n, 0, nmax}] (* _Jean-François Alcover_, Oct 10 2021, after _Ray Chandler_ in A003309 *) %o A237126 (Haskell) %o A237126 import Data.List (transpose) %o A237126 a237126 n = a237126_list !! n %o A237126 a237126_list = 0 : es where %o A237126 es = 1 : concat (transpose [map a192607 es, map (a003309 . (+ 1)) es]) %o A237126 -- _Reinhard Zumkeller_, Feb 10 2014, Feb 06 2014 %o A237126 (Scheme) %o A237126 ;; With Antti Karttunen's IntSeq-library for memoizing definec-macro. %o A237126 (definec (A237126 n) (cond ((< n 2) n) ((even? n) (A192607 (A237126 (/ n 2)))) (else (A003309 (+ 1 (A237126 (/ (- n 1) 2))))))) ;; _Antti Karttunen_, Feb 07 2014 %Y A237126 Cf. A237427 (inverse), A237056, A235491. %Y A237126 Similarly constructed permutations: A227413/A135141. %K A237126 nonn %O A237126 0,3 %A A237126 _Antti Karttunen_ and _Reinhard Zumkeller_, Feb 06 2014