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.

A277514 Irregular triangle read by rows: T(n,k) is the number of primes with n balanced ternary digits of which 2k+1 (3 <= 2k+1 <= n) are nonzero.

Original entry on oeis.org

4, 6, 8, 10, 7, 35, 11, 70, 30, 7, 129, 143, 10, 191, 458, 93, 11, 262, 1112, 605, 11, 370, 2209, 2513, 273, 8, 484, 4007, 7646, 2562, 10, 595, 6683, 19361, 12878, 938, 9, 765, 10697, 42633, 47555, 10311, 11, 917, 16103, 85860, 143382, 62541, 3183
Offset: 3

Views

Author

Lei Zhou, Oct 18 2016

Keywords

Comments

This sequence has the same indexing rule as A277513.
There are no zeros in this sequence up to the (10^5)-th term.
It is conjectured that all terms of this sequence are greater than zero, or else there are infinitely many zero terms. The first zero term might appear beyond 10^6.

Examples

			When n=3 and k=1, there are the following three trits balanced ternary numbers: 5=1TT, 7=1T1, 11=11T, 13=111. All four of them are primes, so T(3,1) = 4;
When n=4 and k=1, there are the following balanced ternary numbers with 2k+1=3 nonzero trits: 17=1T0T, 19=1T01, 23=10TT, 25=10T1, 29=101T, 31=1011, 35=110T, 37=1101. Among these 8 numbers, 6 of them are prime, so T(4,1) = 6.
By listing the first few rows, this sequence appears as:
        k=1        2        3        4
n=3       4
n=4       6
n=5       8       10
n=6       7       35
n=8      11       70       30
n=9       7      129      143
n=10     10      191      458       93
		

Crossrefs

2 together with the column 1 gives A196698.

Programs

  • Mathematica
    (* This converts number m to balanced ternary form, stores the result in list t. *)
    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];
    (* This calculates j and k for balanced ternary form of number m. *)
    BTnonzeroNumofDigits[m_Integer] :=
      Module[{n = m}, t = BTDigits[n, {}]; j = Length[t];
       k = 0; Do[If[t[[i]] != 0, k++], {i, 1, j}];
       k = (k - 1)/2; {j, k}];
    (* This calculates the category index n as defined in A277513 for a {j,k} pair. *)
    IndexA277513[{j_, k_}] :=
      Module[{m, i},
       If[OddQ[j], m = (j - 1)/2; i = m^2 - m + k, m = j/2;
        i = m^2 - 2 m + 1 + k]];
    (* This counts a(n). *)
    p=3;a={} ;While[p = NextPrime[p]; jk = BTnonzeroNumofDigits[p]; jk[[1]] <= 15, id = IndexA277513[jk]; While[Length[a] < id, AppendTo[a, 0]];
      a[[id]]++];a