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 A246208 #27 Apr 28 2021 10:10:50 %S A246208 0,1,2,5,11,3,10,4,22,45,91,9,19,39,183,7,21,23,90,44,182,20,6,8,38, %T A246208 18,78,157,315,37,75,151,631,17,77,13,27,55,155,311,623,111,1263,35, %U A246208 303,47,181,43,365,41,89,367,15,79,314,156,630,76,16,36,150,74,302,180,46,88,14,366,42,40,364,12,54,26,110,34 %N A246208 Permutation of nonnegative integers: a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 2*a(-(A117966(n))), otherwise a(n) = 1 + 2*a(A117966(n)-1). %C A246208 This is an instance of entanglement permutation, where complementary pair A117968/A117967 (negative and positive part of inverse of balanced ternary enumeration of integers, respectively) is entangled with complementary pair A005843/A005408 (even and odd numbers respectively), with a(0) set to 0 and a(1) set to 1. %C A246208 Thus this shares with A140264 the property that apart from a(0) = 0, even numbers occur only in positions given by A117968, and odd numbers only in positions given by A117967. %H A246208 Antti Karttunen, <a href="/A246208/b246208.txt">Table of n, a(n) for n = 0..6561</a> %H A246208 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A246208 a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 2*a(-(A117966(n))), otherwise a(n) = 1 + 2*a(A117966(n)-1). %F A246208 As a composition of related permutations: %F A246208 a(n) = A054429(A246210(n)). %F A246208 a(n) = A246210(A246211(n)). %o A246208 (Scheme, with memoizing definec-macro from _Antti Karttunen_'s IntSeq-library) %o A246208 (definec (A246208 n) (cond ((<= n 1) n) ((negative? (A117966 n)) (* 2 (A246208 (- (A117966 n))))) (else (+ 1 (* 2 (A246208 (- (A117966 n) 1))))))) %o A246208 (Python) %o A246208 def a117966(n): %o A246208 if n==0: return 0 %o A246208 if n%3==0: return 3*a117966(n//3) %o A246208 elif n%3==1: return 3*a117966((n - 1)//3) + 1 %o A246208 else: return 3*a117966((n - 2)//3) - 1 %o A246208 def a(n): %o A246208 if n<2: return n %o A246208 x=a117966(n) %o A246208 if x<1: return 2*a(-x) %o A246208 else: return 1 + 2*a(x - 1) %o A246208 print([a(n) for n in range(101)]) # _Indranil Ghosh_, Jun 07 2017 %Y A246208 Inverse: A246207. %Y A246208 Related permutations: A140264, A054429, A246210, A246211. %Y A246208 Cf. A005408, A005843, A117966, A117967, A117968. %K A246208 nonn %O A246208 0,3 %A A246208 _Antti Karttunen_, Aug 19 2014