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.

This page as a plain text file.
%I A379049 #14 Mar 09 2025 13:14:09
%S A379049 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,
%T A379049 17,9,8,15,23,22,43,41,38,73,37,36,71,107,106,211,221,116,127,81,46,
%U A379049 57,103,68,101,53,32,43,25,18,29,47,40,73,97,76,131,69,62,117
%N 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.
%C A379049 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.
%C A379049 Conjecture: All positive integers greater than 1 appear in this sequence at least once.
%H A379049 John Tyler Rascoe, <a href="/A379049/b379049.txt">Table of n, a(n) for n = 0..10000</a>
%e A379049 When n = 0, its BT presentation is 0, thus a(0) = 1 + 1 = 2;
%e A379049 When n = 1, its BT presentation is 1, the first prime is 2, thus a(1) = 2 + 1 = 3;
%e A379049 ...
%e A379049 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;
%e A379049 ...
%e A379049 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.
%t A379049 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];
%t A379049 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
%o A379049 (Python)
%o A379049 from sympy import prime
%o A379049 def A140267(n): # see A140267
%o A379049     return
%o A379049 def A379049(n):
%o A379049     x,y,z = 1,1,str(A140267(n))[::-1]
%o A379049     for i in range(len(z)):
%o A379049         if z[i] == "1":
%o A379049             x *= prime(i+1)
%o A379049         if z[i] == "2":
%o A379049             y *= prime(i+1)
%o A379049     return x+y # _John Tyler Rascoe_, Feb 27 2025
%Y A379049 Cf. A005812, A134022, A134023, A140267.
%K A379049 new,base,easy,nonn
%O A379049 0,1
%A A379049 _Lei Zhou_, Dec 14 2024