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 A266150 #14 Jan 20 2019 23:18:55 %S A266150 0,1,4,3,2,9,12,7,16,5,36,19,6,25,28,15,8,33,20,11,18,73,76,39,48,13, %T A266150 100,51,14,57,60,31,64,17,132,67,10,41,44,23,144,37,292,147,38,153, %U A266150 156,79,24,97,52,27,50,201,204,103,112,29,228,115,30,121,124,63,32 %N A266150 Take the binary representation of n, increase each run of 0's by one 0 if the length of run is odd, otherwise, if length of run is even, remove one 0. a(n) is the decimal equivalent of the result. %C A266150 This is a self-inverse permutation of the positive integers. %H A266150 Rémy Sigrist, <a href="/A266150/b266150.txt">Table of n, a(n) for n = 0..8192</a> %H A266150 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A266150 a(4) = 2 since 4 = 100 binary -> 10 = 2 decimal. %e A266150 a(5) = 9 since 5 = 101 binary -> 1001 = 9 decimal. %e A266150 a(6) = 12 since 6 = 110 binary -> 1100 = 12 decimal. %t A266150 Table[FromDigits[#, 2] &@ Flatten[If[First@ # == 0, If[OddQ@ Length@ #, Append[IntegerDigits@ #, 0], Most@ IntegerDigits@ #], #] & /@ Split@ IntegerDigits[n, 2]], {n, 64}] (* _Michael De Vlieger_, Dec 22 2015 *) %o A266150 (PARI) a(n) = if (n==0, 0, my (b=n%2, r=valuation(n+b, 2), rr=if (b, r, r%2, r+1, r-1)); (a(n\2^r)+b)*2^rr-b) \\ _Rémy Sigrist_, Jan 20 2019 %Y A266150 Cf. A007088, A084483, A162853, A175046, A175047, A175048, A266151. %K A266150 nonn,base %O A266150 0,3 %A A266150 _Alex Ratushnyak_, Dec 21 2015 %E A266150 a(0) = 0 prepended by _Rémy Sigrist_, Jan 20 2019