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.

A379049 a(n) = prime(i)*dp(n,i) + prime(i)*dn(n,i) where dp(n,i) = 1 when the i-th trit of n is 1, dn(n,i) = 1 when the i-th trit of n is T, and dp(n,i) = dn(n,i) = 0 when the i-th trit of n is 0.

Original entry on oeis.org

2, 3, 5, 4, 7, 11, 8, 13, 7, 6, 11, 17, 16, 31, 37, 22, 29, 17, 12, 19, 31, 26, 47, 13, 10, 17, 9, 8, 15, 23, 22, 43, 41, 38, 73, 37, 36, 71, 107, 106, 211, 221, 116, 127, 81, 46, 57, 103, 68, 101, 53, 32, 43, 25, 18, 29, 47, 40, 73, 97, 76, 131, 69, 62, 117
Offset: 0

Views

Author

Lei Zhou, Dec 14 2024

Keywords

Comments

The Balanced Ternary presentation of a number is a series of 1, 0, and T, where T represent -1. For example, 35 = 110T = 1 * 3^3 + 1* 3^2 + 0 * 3 - 1 = 27 + 9 + 0 - 1.
Conjecture: All positive integers greater than 1 appear in this sequence at least once.

Examples

			When n = 0, its BT presentation is 0, thus a(0) = 1 + 1 = 2;
When n = 1, its BT presentation is 1, the first prime is 2, thus a(1) = 2 + 1 = 3;
...
When n = 14, its BT presentation is 1TTT, thus prime 7 appears before the plus sign and primes 5, 3, and 2 appear in the term after the plus sign, a(14) = 7 + 5*3*2 = 37;
...
By the same rule, when n = 64, its BT presentation is 1T101, thus prime 11, 5, 2 appear before the plus sign and prime 7 appears in the term after the plus sign, a(64) = 11*5*2 + 7 = 117.
		

Crossrefs

Programs

  • Mathematica
    BTDigits[m_Integer, g_]:= Module[{n = m, d, sign, t = g}, If[n != 0, If[n > 0, sign = 1, sign = -1; n = -n]; d = Ceiling[Log[3, n]]; If[3^d - n <= ((3^d - 1)/2), d++]; While[Length[t] < d, PrependTo[t, 0]]; t[[Length[t] + 1 - d]] = sign; t = BTDigits[sign*(n - 3^(d - 1)), t]]; t];
    res = {}; Do[BT = BTDigits[i, {0}]; BTl = Length[BT]; f = 1; b = 1; Do[If[BT[[j]] == 1, f = f*Prime[BTl - j + 1]]; If[BT[[j]] == -1, b = b*Prime[BTl - j + 1]], {j, 1, BTl}];  d = f + b; AppendTo[res, d], {i, 0, 64}]; res
  • Python
    from sympy import prime
    def A140267(n): # see A140267
        return
    def A379049(n):
        x,y,z = 1,1,str(A140267(n))[::-1]
        for i in range(len(z)):
            if z[i] == "1":
                x *= prime(i+1)
            if z[i] == "2":
                y *= prime(i+1)
        return x+y # John Tyler Rascoe, Feb 27 2025