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.

A373712 a(n) is the least m >= 0 with the same number of ternary digits as n such that for some permutation p of 0..2, applying p to the ternary digits of n yields the ternary digits of m.

This page as a plain text file.
%I A373712 #14 Aug 06 2024 16:38:45
%S A373712 0,1,1,3,4,3,3,3,4,9,10,11,12,13,12,11,10,9,9,11,10,11,9,10,12,12,13,
%T A373712 27,28,29,30,31,32,33,34,35,36,37,38,39,40,39,38,37,36,35,34,33,32,31,
%U A373712 30,29,28,27,27,29,28,33,35,34,30,32,31,35,33,34,29,27
%N A373712 a(n) is the least m >= 0 with the same number of ternary digits as n such that for some permutation p of 0..2, applying p to the ternary digits of n yields the ternary digits of m.
%C A373712 Leading zeros in ternary expansions are ignored.
%C A373712 Empirically, A134025 corresponds to the fixed points of this sequence.
%C A373712 The lexicographically latest sequence b of distinct nonnegative integers such that for any n >= 0, a(n) = a(b(n)) is A371268.
%H A373712 Rémy Sigrist, <a href="/A373712/b373712.txt">Table of n, a(n) for n = 0..6560</a>
%F A373712 a(n) <= n.
%F A373712 a(a(n)) = a(n).
%e A373712 The first terms, alongside their ternary expansions, are:
%e A373712   n   a(n)  ter(n)  ter(a(n))
%e A373712   --  ----  ------  ---------
%e A373712    0     0       0          0
%e A373712    1     1       1          1
%e A373712    2     1       2          1
%e A373712    3     3      10         10
%e A373712    4     4      11         11
%e A373712    5     3      12         10
%e A373712    6     3      20         10
%e A373712    7     3      21         10
%e A373712    8     4      22         11
%e A373712    9     9     100        100
%e A373712   10    10     101        101
%e A373712   11    11     102        102
%e A373712   12    12     110        110
%e A373712   13    13     111        111
%e A373712   14    12     112        110
%e A373712   15    11     120        102
%e A373712   16    10     121        101
%o A373712 (PARI) a(n, base = 3) = { my (d = digits(n, base), m = vector(base, i, -1), u = 1); for (i = 1, #d, if (m[1+d[i]] < 0, m[1+d[i]] = u; u = if (u==1, 0, u==0, 2, u+1);); d[i] = m[1+d[i]];); fromdigits(d, base); }
%Y A373712 Cf. A134025, A371268, A373696 (decimal analog).
%K A373712 nonn,base
%O A373712 0,4
%A A373712 _Rémy Sigrist_, Aug 04 2024