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 A246209 #24 May 02 2021 11:09:09 %S A246209 0,1,5,2,15,22,3,7,52,66,35,71,4,6,11,23,137,194,148,213,36,73,99,172, %T A246209 17,8,16,21,12,25,33,58,462,601,447,643,431,620,304,516,37,72,104,173, %U A246209 127,225,419,587,45,64,9,19,47,68,49,69,13,24,29,59,43,75,152,197,1273,1734,1334,1940,1294,1740,899,1556,1404,1837,945,1567,389,698,1246,1761,41 %N A246209 Permutation of nonnegative integers: a(0) = 0, a(1) = 1, a(2n) = A117967(1+a(n)), a(2n+1) = A117968(a(n)). %C A246209 This is an instance of entanglement permutation, where complementary pair A005843/A005408 (even and odd numbers respectively) is entangled with complementary pair A117967/A117968 (positive and negative part of inverse of balanced ternary enumeration of integers, respectively), with a(0) set to 0 and a(1) set to 1. %C A246209 This implies that the even positions contain only terms of A117967 and apart from a(1) = 1, the odd positions contain only terms of A117968. %H A246209 Antti Karttunen, <a href="/A246209/b246209.txt">Table of n, a(n) for n = 0..2047</a> %H A246209 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A246209 a(0) = 0, a(1) = 1, a(2n) = A117967(1+a(n)), a(2n+1) = A117968(a(n)). %F A246209 As a composition of related permutations: %F A246209 a(n) = A246207(A054429(n)). %F A246209 a(n) = A246211(A246207(n)). %o A246209 (Scheme, with memoizing definec-macro from _Antti Karttunen_'s IntSeq-library) %o A246209 (definec (A246209 n) (cond ((<= n 1) n) ((odd? n) (A117968 (A246209 (/ (- n 1) 2)))) ((even? n) (A117967 (+ 1 (A246209 (/ n 2))))))) %o A246209 (Python) %o A246209 from sympy.ntheory.factor_ import digits %o A246209 def a004488(n): return int("".join(str((3 - i)%3) for i in digits(n, 3)[1:]), 3) %o A246209 def a117968(n): %o A246209 if n==1: return 2 %o A246209 if n%3==0: return 3*a117968(n//3) %o A246209 elif n%3==1: return 3*a117968((n - 1)//3) + 2 %o A246209 else: return 3*a117968((n + 1)//3) + 1 %o A246209 def a117967(n): return 0 if n==0 else a117968(-n) if n<0 else a004488(a117968(n)) %o A246209 def a(n): return n if n<2 else a117967(1 + a(n//2)) if n%2==0 else a117968(a((n - 1)//2)) %o A246209 print([a(n) for n in range(101)]) # _Indranil Ghosh_, Jun 07 2017 %Y A246209 Inverse: A246210. %Y A246209 Related permutations: A054429, A246207, A246211. %Y A246209 Cf. A117967, A117968. %K A246209 nonn %O A246209 0,3 %A A246209 _Antti Karttunen_, Aug 19 2014