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 A263273 #58 Sep 09 2017 19:24:57 %S A263273 0,1,2,3,4,7,6,5,8,9,10,19,12,13,22,21,16,25,18,11,20,15,14,23,24,17, %T A263273 26,27,28,55,30,37,64,57,46,73,36,31,58,39,40,67,66,49,76,63,34,61,48, %U A263273 43,70,75,52,79,54,29,56,33,38,65,60,47,74,45,32,59,42,41,68,69,50,77,72,35,62,51,44,71,78,53,80,81 %N A263273 Bijective base-3 reverse: a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n). %C A263273 Here the base-3 reverse has been adjusted so that the maximal suffix of trailing zeros (in base-3 representation A007089) stays where it is at the right side, and only the section from the most significant digit to the least significant nonzero digit is reversed, thus making this sequence a self-inverse permutation of nonnegative integers. %C A263273 Because successive powers of 3 and 9 modulo 2, 4 and 8 are always either constant 1, 1, 1, ... or alternating 1, -1, 1, -1, ... it implies similar simple divisibility rules for 2, 4 and 8 in base 3 as e.g. 3, 9 and 11 have in decimal base (see the Wikipedia-link). As these rules do not depend on which direction they are applied from, it means that this bijection preserves the fact whether a number is divisible by 2, 4 or 8, or whether it is not. Thus natural numbers are divided to several subsets, each of which is closed with respect to this bijection. See the Crossrefs section for permutations obtained from these sections. %C A263273 When polynomials over GF(3) are encoded as natural numbers (coefficients presented with the digits of the base-3 expansion of n), this bijection works as a multiplicative automorphism of the ring GF(3)[X]. This follows from the fact that as there are no carries involved, the multiplication (and thus also the division) of such polynomials could be as well performed by temporarily reversing all factors (like they were seen through mirror). This implies also that the sequences A207669 and A207670 are closed with respect to this bijection. %H A263273 Antti Karttunen, <a href="/A263273/b263273.txt">Table of n, a(n) for n = 0..6561</a> %H A263273 Wikipedia, <a href="https://en.wikipedia.org/wiki/Divisibility_rule">Divisibility rule</a> %H A263273 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A263273 a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n). %F A263273 Other identities. For all n >= 0: %F A263273 a(3*n) = 3*a(n). %F A263273 A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.] %F A263273 A010873(a(n)) = 0 if and only if A010873(n) = 0. [See the comments section.] %e A263273 For n = 15, A007089(15) = 120. Reversing this so that the trailing zero stays at the right yields 210 = A007089(21), thus a(15) = 21 and vice versa, a(21) = 15. %t A263273 r[n_] := FromDigits[Reverse[IntegerDigits[n, 3]], 3]; b[n_] := n/ 3^IntegerExponent[n, 3]; c[n_] := n/b[n]; a[0]=0; a[n_] := r[b[n]]*c[n]; Table[a[n], {n, 0, 80}] (* _Jean-François Alcover_, Dec 29 2015 *) %o A263273 (Scheme) (define (A263273 n) (if (zero? n) n (* (A030102 (A038502 n)) (A038500 n)))) %o A263273 (Python) %o A263273 from sympy import factorint %o A263273 from sympy.ntheory.factor_ import digits %o A263273 from operator import mul %o A263273 def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3) %o A263273 def a038502(n): %o A263273 f=factorint(n) %o A263273 return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f]) %o A263273 def a038500(n): return n/a038502(n) %o A263273 def a(n): return 0 if n==0 else a030102(a038502(n))*a038500(n) # _Indranil Ghosh_, May 22 2017 %Y A263273 Bisections: A264983, A264984. %Y A263273 Cf. A000035, A007089, A010873, A030102, A038500, A038502, A207669, A207670. %Y A263273 Cf. also A057889, A264965, A264966, A264980. %Y A263273 Permutations induced by various sections: A263272 (a(2n)/2), A264974 (a(4n)/4), A264978 (a(8n)/8), A264985, A264989. %Y A263273 Cf. also A004488, A140263, A140264, A246207, A246208 (other base-3 related permutations). %K A263273 nonn,base %O A263273 0,3 %A A263273 _Antti Karttunen_, Dec 05 2015