cp's OEIS Frontend

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.

A163327 Self-inverse permutation of integers: swap the odd- and even-positioned digits in the ternary expansion of n, then convert back to decimal.

This page as a plain text file.
%I A163327 #21 Aug 05 2022 15:35:09
%S A163327 0,3,6,1,4,7,2,5,8,27,30,33,28,31,34,29,32,35,54,57,60,55,58,61,56,59,
%T A163327 62,9,12,15,10,13,16,11,14,17,36,39,42,37,40,43,38,41,44,63,66,69,64,
%U A163327 67,70,65,68,71,18,21,24,19,22,25,20,23,26,45,48,51,46,49,52,47,50,53
%N A163327 Self-inverse permutation of integers: swap the odd- and even-positioned digits in the ternary expansion of n, then convert back to decimal.
%H A163327 Antti Karttunen, <a href="/A163327/b163327.txt">Table of n, a(n) for n = 0..728</a>
%H A163327 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A163327 a(n) = A037314(A163326(n)) + 3*A037314(A163325(n))
%e A163327 11 in ternary base (A007089) is written as '(000...)102' (... + 0*27 + 1*9 + 0*3 + 2), which results '1020' = 1*27 + 0*9 + 2*3 + 0 = 33, when the odd- and even-positioned digits are swapped, thus a(11) = 33.
%o A163327 (Scheme) (define (A163327 n) (+ (A037314 (A163326 n)) (* 3 (A037314 (A163325 n)))))
%o A163327 (Python)
%o A163327 from sympy.ntheory import digits
%o A163327 def a(n):
%o A163327     d = digits(n, 3)[1:]
%o A163327     return sum(3**(i+(1-2*(i&1)))*di for i, di in enumerate(d[::-1]))
%o A163327 print([a(n) for n in range(72)]) # _Michael S. Branicky_, Aug 05 2022
%Y A163327 Cf. A007089, A163328-A163329.
%Y A163327 Other bases: A057300, A126006, A217558.
%K A163327 nonn,base,look
%O A163327 0,2
%A A163327 _Antti Karttunen_, Jul 29 2009
%E A163327 Edited by _Charles R Greathouse IV_, Nov 01 2009