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.

A371268 If the ternary expansion of n starts with a 1, replace 1's by 2's, 2's by 0's, 0's by 1's, if it starts with a 2, replace 2's by 1's, 1's by 0's, 0's by 2's.

This page as a plain text file.
%I A371268 #10 Mar 18 2024 13:23:58
%S A371268 0,2,1,7,8,6,5,3,4,22,23,21,25,26,24,19,20,18,17,15,16,11,9,10,14,12,
%T A371268 13,67,68,66,70,71,69,64,65,63,76,77,75,79,80,78,73,74,72,58,59,57,61,
%U A371268 62,60,55,56,54,53,51,52,47,45,46,50,48,49,35,33,34,29,27
%N A371268 If the ternary expansion of n starts with a 1, replace 1's by 2's, 2's by 0's, 0's by 1's, if it starts with a 2, replace 2's by 1's, 1's by 0's, 0's by 2's.
%C A371268 This sequence is a self-inverse permutation of the nonnegative integers.
%H A371268 Rémy Sigrist, <a href="/A371268/b371268.txt">Table of n, a(n) for n = 0..6560</a>
%H A371268 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A371268 A371256(a(n)) = A371256(n).
%e A371268 The first terms, in decimal and in base 3, are:
%e A371268   n   a(n)  ter(n)  ter(a(n))
%e A371268   --  ----  ------  ---------
%e A371268    0     0       0          0
%e A371268    1     2       1          2
%e A371268    2     1       2          1
%e A371268    3     7      10         21
%e A371268    4     8      11         22
%e A371268    5     6      12         20
%e A371268    6     5      20         12
%e A371268    7     3      21         10
%e A371268    8     4      22         11
%e A371268    9    22     100        211
%e A371268   10    23     101        212
%e A371268   11    21     102        210
%e A371268   12    25     110        221
%e A371268   13    26     111        222
%e A371268   14    24     112        220
%e A371268   15    19     120        201
%o A371268 (PARI) a(n) = { my (d = digits(n, 3)); if (#d, d = if (d[1]==1, apply(v -> [1, 2, 0][1+v], d), apply(v -> [2, 0, 1][1+v], d));); fromdigits(d, 3); }
%Y A371268 See A004488 and A361945 for similar sequences.
%Y A371268 Cf. A338246, A371256.
%K A371268 nonn,base,easy
%O A371268 0,2
%A A371268 _Rémy Sigrist_, Mar 16 2024