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 A263272 #22 May 23 2017 20:59:17 %S A263272 0,1,2,3,4,5,6,11,8,9,10,7,12,13,14,15,32,23,18,29,20,33,38,17,24,35, %T A263272 26,27,28,19,30,37,16,21,34,25,36,31,22,39,40,41,42,95,68,45,86,59,96, %U A263272 113,50,69,104,77,54,83,56,87,110,47,60,101,74,99,92,65,114,119,44,51,98,71,72,89,62,105,116,53,78,107,80,81 %N A263272 Self-inverse permutation of nonnegative integers: a(n) = A263273(2*n) / 2. %H A263272 Antti Karttunen, <a href="/A263272/b263272.txt">Table of n, a(n) for n = 0..9841</a> %H A263272 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A263272 a(n) = A263273(2*n) / 2 = A264984(n) / 2. %F A263272 As a composition of related permutations: %F A263272 a(n) = A264974(A264975(n)) = A264976(A264974(n)). %F A263272 Other identities. For all n >= 0: %F A263272 a(3*n) = 3*a(n). %F A263272 A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.] %F A263272 A264974(n) = a(2n)/2. [Thus the restriction onto even numbers induces yet another permutation.] %t A263272 f[n_] := Block[{g, h}, g[x_] := x/3^IntegerExponent[x, 3]; h[x_] := x/g@ x; If[n == 0, 0, FromDigits[Reverse@ IntegerDigits[#, 3], 3] &@ g[n] h[n]]]; Table[f[2 n]/2, {n, 0, 81}] (* _Michael De Vlieger_, Jan 04 2016,after _Jean-François Alcover_ at A263273 *) %o A263272 (Scheme) (define (A263272 n) (/ (A263273 (+ n n)) 2)) %o A263272 (Python) %o A263272 from sympy import factorint %o A263272 from sympy.ntheory.factor_ import digits %o A263272 from operator import mul %o A263272 def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3) %o A263272 def a038502(n): %o A263272 f=factorint(n) %o A263272 return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f]) %o A263272 def a038500(n): return n/a038502(n) %o A263272 def a263273(n): return 0 if n==0 else a030102(a038502(n))*a038500(n) %o A263272 def a(n): return a263273(2*n)/2 # _Indranil Ghosh_, May 23 2017 %Y A263272 Cf. A000035, A263273. %Y A263272 Bisections: A264986, A264987. %Y A263272 Cf. also A246200, A264967, A264968, A264974, A264978, A264975, A264976, A264984. %K A263272 nonn,base %O A263272 0,3 %A A263272 _Antti Karttunen_, Dec 05 2015