A336004 Numbers whose mixed binary-ternary representation is not a binary or ternary representation. See Comments.
13, 14, 22, 23, 26, 31, 35, 38, 39, 41, 42, 43, 44, 45, 46, 47, 50, 51, 52, 53, 58, 59, 62, 67, 70, 71, 73, 74, 75, 76, 77, 78, 79, 85, 86, 89, 94, 95, 97, 98, 103, 104, 107, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 131
Offset: 1
Examples
7 = 6 + 1 = 21_3 is not a term; 11 = 9 + 2 = 102_3 is not a term; 13 = 9 + 4 = 3^2 + 2^2 is a term; 22 = 18 + 4 = 2*3^2 + 2^2 is a term.
Programs
-
Mathematica
u = Table[2^n, {n, 0, 50}]; v = Table[3^n, {n, 0, 40}]; uQ[n_] := MemberQ[u, n]; vQ[n_] := MemberQ[v, n]; Attributes[uQ] = {Listable}; Attributes[vQ] = {Listable}; s = Reverse[Union[Flatten[Table[{2^(n - 1), 3^n}, {n, 1, 30}]]]]; w = Map[#[[1]] &,Select[Map[{#[[1]], {Apply[And, uQ[#[[2]]]], Apply[And, vQ[#[[2]]]]}} &, Map[{#, DeleteCases[ s Reap[FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #, s]][[2, 1]], 0]} &, Range[700]]], #[[2]] == {False, False} &]] (* Peter J. C. Moses, Jun 14 2020 *)
-
Python
from itertools import count, takewhile N = 10**6 B1 = list(takewhile(lambda x: x[0] <= N, ((2**i, 2) for i in count(0)))) B21 = list(takewhile(lambda x: x[0] <= N, ((3**i, 3) for i in count(0)))) B22 = list(takewhile(lambda x: x[0] <= N, ((2*3**i, 3) for i in count(0)))) B = sorted(set(B1 + B21 + B22), reverse=True) def ok(n): r, bases = [], set() for t, b in B: if t <= n: r.append(t) if t != 1 and t != 2: bases.add(b) n -= t if n == 0: return len(bases) == 2 print([k for k in range(1, 132) if ok(k)]) # Michael S. Branicky, Jan 06 2022
Extensions
Terms and examples corrected by Michael S. Branicky, Jan 06 2022
Comments