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.

A371275 a(n) is the number of runs in the balanced ternary expansion of n.

This page as a plain text file.
%I A371275 #5 Mar 18 2024 09:51:23
%S A371275 0,1,2,2,1,2,3,3,3,2,3,2,2,1,2,3,3,4,3,4,4,4,3,3,4,4,3,2,3,4,4,3,2,3,
%T A371275 3,3,2,3,2,2,1,2,3,3,4,3,4,4,4,3,4,5,5,4,3,4,5,5,4,4,5,5,5,4,5,4,4,3,
%U A371275 3,4,4,5,4,5,5,5,4,3,4,4,3,2,3,4,4,3,4
%N A371275 a(n) is the number of runs in the balanced ternary expansion of n.
%C A371275 Leading zeros are ignored.
%C A371275 Every positive integers occurs infinitely many times.
%F A371275 a(n) <= A134021(n).
%F A371275 a(A153773(k)) = k for any k > 0.
%e A371275 The first terms, alongside the balanced ternary expansion of n, are:
%e A371275   n    a(n)  bter(n)
%e A371275   ---  ----  -------
%e A371275     0     0        0
%e A371275     1     1        1
%e A371275     2     2       1T
%e A371275     3     2       10
%e A371275     4     1       11
%e A371275     5     2      1TT
%e A371275     6     3      1T0
%e A371275     7     3      1T1
%e A371275     8     3      10T
%e A371275     9     2      100
%e A371275    10     3      101
%e A371275    11     2      11T
%e A371275    12     2      110
%e A371275    13     1      111
%e A371275    14     2     1TTT
%e A371275    15     3     1TT0
%o A371275 (PARI) a(n) = { my (r = 0, d); while (n, r++; d = centerlift(Mod(n, 3)); while (d==centerlift(Mod(n, 3)), n = (n-d)/3;);); return (r); }
%Y A371275 Cf. A005811, A043555, A134021, A153773, A297770.
%K A371275 nonn,base,easy
%O A371275 0,3
%A A371275 _Rémy Sigrist_, Mar 17 2024