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.

Showing 1-3 of 3 results.

A336005 a(n) is the number of terms in the mixed binary-ternary representation of n. See Comments.

Original entry on oeis.org

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, 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, 3, 2, 3, 2, 2, 3, 3, 3, 3, 4, 3, 2, 1, 2, 2, 2, 2, 3
Offset: 1

Views

Author

Clark Kimberling, Jul 06 2020

Keywords

Comments

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).

Examples

			7 = 6 + 1, so a(7) = 2.
45 = 32 + 9 + 4, so a(45) = 3.
		

Crossrefs

Programs

  • Mathematica
    z = 20; zz = 100;
    b1 = Sort[Table[2^k, {k, 0, z}], Greater];
    b2 = Sort[Union[Table[3^k, {k, 0, z}], Table[2*3^k, {k, 0, z}]],
       Greater]; b = Sort[Union[b1, b2], Greater];
    g1 = Map[{#, DeleteCases[b1  Reap[
             FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #, b1]][[2,
             1]], 0]} &, Range[zz]];
    m1 = Map[Length[#[[2]]] &, g1];
    g2 = Map[{#, DeleteCases[b2 Reap[FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #, b2]][[2, 1]], 0]} &, Range[zz]];
    m2 = Map[Length[#[[2]]] &, g2];
    g = Map[{#, DeleteCases[
         b Reap[FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #,
             b]][[2, 1]], 0]} &, Range[zz]]
    m = Map[Length[#[[2]]] &, g];
    m1 (* # terms in binary representation *)
    m2 (* # terms in ternary representation *)
    m  (* # terms in mixed base representation *)  (* A336005 *)
  • 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 gbt(n, B): # greedy binary-ternary representation
        r = []
        for t, b in B:
            if t <= n:
                r.append(t)
                n -= t
                if n == 0:
                    return r
    def a(n): return len(gbt(n, B))
    print([a(n) for n in range(1, 87)]) # Michael S. Branicky, Jan 06 2022

A336006 a(n) = the least k such that the mixed binary-ternary representation of k has n terms. See Comments.

Original entry on oeis.org

1, 5, 14, 46, 127, 383, 1407, 3594, 11786, 31469, 97005, 451299, 982740, 3079892, 7862861, 24640077, 110733519, 244951247, 1019792225, 3344315159, 13804668362, 48164406730, 185603360202, 468032896683, 1567544524459, 4109410352788, 12905503374996, 58659088284918
Offset: 1

Views

Author

Clark Kimberling, Jul 06 2020

Keywords

Comments

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).

Examples

			1 = 1 (1 term);
5 = 4 + 1 (2 terms);
14 = 9 + 4 + 1 (3 terms);
46 = 32 + 9 + 4 + 1 (4 terms);
127 = 81 + 32 + 9 + 4 + 1 (5 terms).
		

Crossrefs

Programs

  • Mathematica
    z = 20; zz = 100000;
    b1 = Sort[Table[2^k, {k, 0, z}], Greater];
    b2 = Sort[Union[Table[3^k, {k, 0, z}], Table[2*3^k, {k, 0, z}]],
       Greater]; b = Sort[Union[b1, b2], Greater];
    g1 = Map[{#, DeleteCases[b1  Reap[
             FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #, b1]][[2,
             1]], 0]} &, Range[zz]];
    m1 = Map[Length[#[[2]]] &, g1];
    g2 = Map[{#, DeleteCases[
          b2 Reap[FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #,
              b2]][[2, 1]], 0]} &, Range[zz]];
    m2 = Map[Length[#[[2]]] &, g2];
    g = Map[{#, DeleteCases[b Reap[FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #,
              b]][[2, 1]], 0]} &, Range[zz]];
    m = Map[Length[#[[2]]] &, g];
    (* Peter J. C. Moses, Jul 05 2020 *)
    Table[First[Flatten[Position[m, k]]], {k, 1, 11}]
  • Python
    from itertools import count, takewhile, islice
    def big_greedy(k, B, start=0):
        idx = start
        while idx < len(B) and B[idx] <= k: idx += 1
        return B[idx - 1]
    def agen(limit=10**1001):
        an, idx, t = 1, 0, 2
        B1 = list(takewhile(lambda x: x <= limit, (2**i for i in count(0))))
        B21 = list(takewhile(lambda x: x <= limit, (3**i for i in count(0))))
        B22 = list(takewhile(lambda x: x <= limit, (2*3**i for i in count(0))))
        B = sorted(set(B1 + B21 + B22))
        while an <= limit:
            yield an
            while t != big_greedy(an+t, B, start=idx):
                idx, t = idx+1, B[idx+1]
            an += t
    print(list(islice(agen(), 28))) # Michael S. Branicky, Jan 06 2022

Formula

a(n+1) = a(n) + t, where t is the least element in B such that the largest element of B in the interval (a(n), a(n) + t) is t; see link for proof. - Michael S. Branicky, Jan 06 2022

Extensions

a(12) and beyond from Michael S. Branicky, Jan 06 2022

A336007 Numbers whose mixed Zeckendorf-Lucas representation is not a Zeckendorf or Lucas representation. See Comments.

Original entry on oeis.org

17, 25, 28, 38, 41, 45, 46, 52, 53, 59, 62, 66, 67, 72, 73, 74, 75, 81, 82, 84, 85, 86, 93, 96, 100, 101, 106, 107, 108, 109, 114, 117, 118, 119, 120, 121, 122, 128, 129, 131, 132, 133, 136, 137, 138, 139, 140, 148, 151, 155, 156, 161, 162, 163, 164, 169
Offset: 1

Views

Author

Clark Kimberling, Jul 06 2020

Keywords

Comments

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.

Examples

			17 = 13 + 4;
25 = 21 + 4;
28 = 21 + 7.
		

Crossrefs

Programs

  • Mathematica
    fibonacciQ[n_] := IntegerQ[Sqrt[5 n^2 + 4]] || IntegerQ[Sqrt[5 n^2 - 4]];
    Attributes[fibonacciQ] = {Listable};
    lucasQ[n_] := IntegerQ[Sqrt[5 n^2 + 20]] || IntegerQ[Sqrt[5 n^2 - 20]];
    Attributes[lucasQ] = {Listable};
    s = Reverse[Union[Flatten[Table[{Fibonacci[n + 1], LucasL[n - 1]}, {n, 1, 22}]]]];
    u = Map[#[[1]] &, Select[Map[{#[[1]], {Apply[And, fibonacciQ[#[[2]]]],
           Apply[And, lucasQ[#[[2]]]]}} &, Map[{#, DeleteCases[
            s Reap[FoldList[(Sow[Quotient[#1, #2]]; Mod[#1, #2]) &, #,
                s]][[2, 1]], 0]} &,
         Range[500]]], #[[2]] == {False, False} &]]
    (* Peter J. C. Moses, Jun 14 2020 *)
Showing 1-3 of 3 results.