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 A345352 #10 Jun 21 2021 03:05:21 %S A345352 0,1,2,3,8,10,9,11,4,6,5,7,12,14,13,15,128,136,132,140,130,138,134, %T A345352 142,129,137,133,141,131,139,135,143,64,72,68,76,66,74,70,78,65,73,69, %U A345352 77,67,75,71,79,192,200,196,204,194,202,198,206,193,201,197,205 %N A345352 The binary expansion of a(n) is obtained by left-padding the binary expansion of n with 0's so that it has 2^k digits for some k > 0 as small as possible and then reversing the first half and the second half of this binary expansion. %C A345352 This sequence is a self-inverse permutation of the nonnegative integers with infinitely many fixed points (A345362). %H A345352 Rémy Sigrist, <a href="/A345352/b345352.txt">Table of n, a(n) for n = 0..8192</a> %H A345352 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %H A345352 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A345352 A000120(a(n)) = A000120(n). %F A345352 a(A001196(n)) = A001196(a(n)). %F A345352 a(n) < 2^2^k for any n < 2^2^k. %F A345352 a(2^k) = 2^A054429(k) for any k > 0. %e A345352 For n = 43: %e A345352 - the binary expansion of n is "101011", %e A345352 - it has 6 binary digits, so we pad it with 2 leading 0's, %e A345352 - the first half is "0010" and its reversal is "0100", %e A345352 - the second half is "1011" and its reversal is "1101", %e A345352 - so the binary expansion of a(43) is "01001101", %e A345352 - and a(43) = 77. %o A345352 (PARI) a(n) = { my (b=binary(n), x); for (k=1, oo, x=2^k-#b; if (x>=0, b=concat(vector(x), b); return (fromdigits(concat(Vecrev(b[1..#b/2]), Vecrev(b[#b/2+1..#b])), 2)))) } %o A345352 (Python) %o A345352 def a(n): %o A345352 b = bin(n)[2:] %o A345352 bb = bin(len(b))[2:] %o A345352 if bb != '1' + '0'*(len(bb)-1): b = '0'*(2**len(bb) - len(b)) + b %o A345352 return int(b[:len(b)//2][::-1] + b[len(b)//2:][::-1], 2) %o A345352 print([a(n) for n in range(60)]) # _Michael S. Branicky_, Jun 15 2021 %Y A345352 Cf. A000120, A001196, A054429, A345362 (fixed points). %K A345352 nonn,base %O A345352 0,3 %A A345352 _Rémy Sigrist_, Jun 15 2021