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.

A343605 a(n) is the greatest number < n with the same sum of balanced ternary digits as n.

This page as a plain text file.
%I A343605 #9 Apr 25 2021 15:14:00
%S A343605 -2,-5,0,1,-14,-1,2,3,6,7,4,9,10,-41,-4,5,8,15,16,11,18,19,12,17,20,
%T A343605 21,24,25,22,27,28,13,26,29,30,33,34,31,36,37,-122,-13,14,23,42,43,32,
%U A343605 45,46,35,44,47,48,51,52,49,54,55,38,53,56,57,60,61,58,63
%N A343605 a(n) is the greatest number < n with the same sum of balanced ternary digits as n.
%C A343605 This sequence can be extended to negative indexes by setting a(-n) = -A343604(n) for any n > 0.
%H A343605 Rémy Sigrist, <a href="/A343605/b343605.txt">Table of n, a(n) for n = 0..10000</a>
%F A343605 a(9*n) = 9*n - 2.
%F A343605 a(A174658(n+1)) = A174658(n) for any n > 0.
%F A343605 a(n) <= 0 iff n belongs to A003462 or to A007051.
%F A343605 a(A003462(k)) = -A007051(k + 1) for any k >= 0.
%F A343605 a(A007051(k)) = -A003462(k - 1) for any k > 0.
%e A343605 The first terms, in base 10 and in balanced ternary (where T denotes the digit -1), alongside A065363(n), are:
%e A343605   n   a(n)  bter(n)  bter(a(n))  A065363(n)
%e A343605   --  ----  -------  ----------  ----------
%e A343605    0    -2        0          T1           0
%e A343605    1    -5        1         T11           1
%e A343605    2     0       1T           0           0
%e A343605    3     1       10           1           1
%e A343605    4   -14       11        T111           2
%e A343605    5    -1      1TT           T          -1
%e A343605    6     2      1T0          1T           0
%e A343605    7     3      1T1          10           1
%e A343605    8     6      10T         1T0           0
%e A343605    9     7      100         1T1           1
%e A343605   10     4      101          11           2
%e A343605   11     9      11T         100           1
%e A343605   12    10      110         101           2
%o A343605 (PARI) A065363(n) = { my (v=0, d); while (n, v+=d=centerlift(Mod(n,3)); n=(n-d)\3); v }
%o A343605 a(n) = my (s=A065363(n)); forstep (k=n-1, -oo, -1, if (s==A065363(k), return (k)))
%Y A343605 Cf. A003462, A007051, A065363, A174658, A343604.
%K A343605 sign,base
%O A343605 0,1
%A A343605 _Rémy Sigrist_, Apr 22 2021