OFFSET
3,1
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.
EXAMPLE
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
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
CROSSREFS
KEYWORD
nonn,base,tabf
AUTHOR
Lei Zhou, Oct 18 2016
STATUS
approved