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.

A361945 If the ternary expansion of n starts with the digit 1, then replace 2's by 0's and vice versa; if the ternary expansion of n starts with the digit 2, then replace 1's by 0's and vice versa; a(0) = 0.

This page as a plain text file.
%I A361945 #12 Apr 02 2023 10:27:43
%S A361945 0,1,2,5,4,3,7,6,8,17,16,15,14,13,12,11,10,9,22,21,23,19,18,20,25,24,
%T A361945 26,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,
%U A361945 31,30,29,28,27,67,66,68,64,63,65,70,69,71,58,57,59,55,54
%N A361945 If the ternary expansion of n starts with the digit 1, then replace 2's by 0's and vice versa; if the ternary expansion of n starts with the digit 2, then replace 1's by 0's and vice versa; a(0) = 0.
%C A361945 Leading zeros in ternary expansions are ignored.
%C A361945 This sequence is a self-inverse permutation of the nonnegative integers.
%H A361945 Rémy Sigrist, <a href="/A361945/b361945.txt">Table of n, a(n) for n = 0..6560</a>
%H A361945 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A361945 a(n) = n iff n belongs to A048328.
%F A361945 a(n) = A171960(n) when A122586(n) = 1.
%e A361945 The first terms, in decimal and in ternary, are:
%e A361945   n   a(n)  ter(n)  ter(a(n))
%e A361945   --  ----  ------  ---------
%e A361945    0     0       0          0
%e A361945    1     1       1          1
%e A361945    2     2       2          2
%e A361945    3     5      10         12
%e A361945    4     4      11         11
%e A361945    5     3      12         10
%e A361945    6     7      20         21
%e A361945    7     6      21         20
%e A361945    8     8      22         22
%e A361945    9    17     100        122
%e A361945   10    16     101        121
%e A361945   11    15     102        120
%e A361945   12    14     110        112
%e A361945   13    13     111        111
%e A361945   14    12     112        110
%e A361945   15    11     120        102
%o A361945 (PARI) a(n) = { my (d = digits(n, 3), m); if (#d==0, m = [0,1,2], d[1]==1, m = [2,1,0], m = [1,0,2]); fromdigits(apply(t -> m[1+t], d), 3); }
%Y A361945 Cf. A048328 (fixed points), A122586, A171960.
%K A361945 nonn,base,easy
%O A361945 0,3
%A A361945 _Rémy Sigrist_, Mar 31 2023