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 A336005 #26 Jan 28 2025 00:49:32 %S A336005 1,1,1,1,2,1,2,1,1,2,2,2,2,3,2,1,2,1,2,2,2,2,3,2,3,2,1,2,2,2,2,1,2,2, %T A336005 2,2,3,2,3,2,2,3,3,3,3,4,3,2,3,2,3,3,3,1,2,2,2,2,3,2,3,2,2,1,2,2,2,2, %U A336005 3,2,3,2,2,3,3,3,3,4,3,2,1,2,2,2,2,3 %N A336005 a(n) is the number of terms in the mixed binary-ternary representation of n. See Comments. %C A336005 Suppose that B1 and B2 are increasing sequences of positive integers, and let B be the increasing sequence of numbers in the union of B1 and B2. Every positive integer n has a unique representation given by the greedy algorithm with B1 as base, and likewise for B2 and B. For many n, the number of terms in the B-representation of n is less than the number of terms in the B1-representation, as well as the B2-representation, but not for all n, as in the example 45 = 27 + 18 (ternary) and 45 = 32 + 9 + 4 (mixed). %H A336005 Michael S. Branicky, <a href="/A336005/b336005.txt">Table of n, a(n) for n = 1..10000</a> %e A336005 7 = 6 + 1, so a(7) = 2. %e A336005 45 = 32 + 9 + 4, so a(45) = 3. %t A336005 z = 20; zz = 100; %t A336005 b1 = Sort[Table[2^k, {k, 0, z}], Greater]; %t A336005 b2 = Sort[Union[Table[3^k, {k, 0, z}], Table[2*3^k, {k, 0, z}]], %t A336005 Greater]; b = Sort[Union[b1, b2], Greater]; %t A336005 g1 = Map[{#, DeleteCases[b1 Reap[ %t A336005 FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #, b1]][[2, %t A336005 1]], 0]} &, Range[zz]]; %t A336005 m1 = Map[Length[#[[2]]] &, g1]; %t A336005 g2 = Map[{#, DeleteCases[b2 Reap[FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #, b2]][[2, 1]], 0]} &, Range[zz]]; %t A336005 m2 = Map[Length[#[[2]]] &, g2]; %t A336005 g = Map[{#, DeleteCases[ %t A336005 b Reap[FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #, %t A336005 b]][[2, 1]], 0]} &, Range[zz]] %t A336005 m = Map[Length[#[[2]]] &, g]; %t A336005 m1 (* # terms in binary representation *) %t A336005 m2 (* # terms in ternary representation *) %t A336005 m (* # terms in mixed base representation *) (* A336005 *) %o A336005 (Python) %o A336005 from itertools import count, takewhile %o A336005 N = 10**6 %o A336005 B1 = list(takewhile(lambda x: x[0] <= N, ((2**i, 2) for i in count(0)))) %o A336005 B21 = list(takewhile(lambda x: x[0] <= N, ((3**i, 3) for i in count(0)))) %o A336005 B22 = list(takewhile(lambda x: x[0] <= N, ((2*3**i, 3) for i in count(0)))) %o A336005 B = sorted(set(B1 + B21 + B22), reverse=True) %o A336005 def gbt(n, B): # greedy binary-ternary representation %o A336005 r = [] %o A336005 for t, b in B: %o A336005 if t <= n: %o A336005 r.append(t) %o A336005 n -= t %o A336005 if n == 0: %o A336005 return r %o A336005 def a(n): return len(gbt(n, B)) %o A336005 print([a(n) for n in range(1, 87)]) # _Michael S. Branicky_, Jan 06 2022 %Y A336005 Cf. A336004, A336006. %K A336005 nonn,base %O A336005 1,5 %A A336005 _Clark Kimberling_, Jul 06 2020