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.
%I A332025 #10 Mar 29 2020 00:27:47 %S A332025 1,1,1,2,2,2,2,2,2,3,2,3,3,3,3,3,2,3,3,3,2,3,3,2,3,3,3,4,3,4,2,3,3,3, %T A332025 3,4,4,3,4,4,4,4,4,3,4,4,3,3,3,3,2,4,3,4,4,4,3,3,4,3,2,3,3,4,3,3,4,4, %U A332025 3,3,2,3,4,4,3,4,4,3,4,4,4,5,4,5,3,4,4,4,4,5,3 %N A332025 Sum of the lengths of the longest runs of 0, 1, and 2 in the ternary expression of n. %C A332025 All positive integers appear in this sequence. Given some number k, there will always be some ternary number that has k 1's or k 2's. %C A332025 The number 0 never appears in this sequence, as every number has at least 1 digit. %H A332025 Wikipedia, <a href="https://en.wikipedia.org/wiki/Ternary_numeral_system">Ternary numeral system</a>. %F A332025 a(n) = A330166(n) + A330167(n) + A330168(n). %F A332025 a(A003462(n)) = a(A024023(n)) = n. %e A332025 For n = 268, the ternary expansion of 268 is 100221. The length of the run of 0's in the ternary expansion of 268 is 2. The length of the runs of 1's in the ternary expansion of 268 are 1 and 1 respectively. The length of the run of 2's in the ternary expansion of 268 is 2. The sum of 2, 1, and 2 is 5, so a(268) = 5. %e A332025 n [ternary n] A330166(n) + A330167(n) + A330168(n) = a(n) %e A332025 0 [ 0] 1 + 0 + 0 = 1 %e A332025 1 [ 1] 0 + 1 + 0 = 1 %e A332025 2 [ 2] 0 + 0 + 1 = 1 %e A332025 3 [ 1 0] 1 + 1 + 0 = 2 %e A332025 4 [ 1 1] 0 + 2 + 0 = 2 %e A332025 5 [ 1 2] 0 + 1 + 1 = 2 %e A332025 6 [ 2 0] 1 + 0 + 1 = 2 %e A332025 7 [ 2 1] 0 + 1 + 1 = 2 %e A332025 8 [ 2 2] 0 + 0 + 2 = 2 %e A332025 9 [ 1 0 0] 2 + 1 + 0 = 3 %e A332025 10 [ 1 0 1] 1 + 1 + 0 = 2 %e A332025 11 [ 1 0 2] 1 + 1 + 1 = 3 %e A332025 12 [ 1 1 0] 1 + 2 + 0 = 3 %e A332025 13 [ 1 1 1] 0 + 3 + 0 = 3 %e A332025 14 [ 1 1 2] 0 + 2 + 1 = 3 %e A332025 15 [ 1 2 0] 1 + 1 + 1 = 3 %e A332025 16 [ 1 2 1] 0 + 1 + 1 = 2 %e A332025 17 [ 1 2 2] 0 + 1 + 2 = 3 %e A332025 18 [ 2 0 0] 2 + 0 + 1 = 3 %e A332025 19 [ 2 0 1] 1 + 1 + 1 = 3 %e A332025 20 [ 2 0 2] 1 + 0 + 1 = 2 %t A332025 Table[Sum[Max@FoldList[If[#2==k,#1+1,0]&,0,IntegerDigits[n,3]],{k,0,2}],{n,1,90}] %Y A332025 Cf. A003462, A007089, A062756, A330036. %Y A332025 Equals A330166 + A330167 + A330168. %K A332025 nonn,base %O A332025 0,4 %A A332025 _Joshua Oliver_, Feb 05 2020