Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #23 Nov 10 2019 14:40:44
%S 4,6,8,10,7,35,11,70,30,7,129,143,10,191,458,93,11,262,1112,605,11,
%T 370,2209,2513,273,8,484,4007,7646,2562,10,595,6683,19361,12878,938,9,
%U 765,10697,42633,47555,10311,11,917,16103,85860,143382,62541,3183
%N 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.
%C This sequence has the same indexing rule as A277513.
%C There are no zeros in this sequence up to the (10^5)-th term.
%C 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.
%e 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;
%e 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.
%e By listing the first few rows, this sequence appears as:
%e k=1 2 3 4
%e n=3 4
%e n=4 6
%e n=5 8 10
%e n=6 7 35
%e n=8 11 70 30
%e n=9 7 129 143
%e n=10 10 191 458 93
%t (* This converts number m to balanced ternary form, stores the result in list t. *)
%t BTDigits[m_Integer, g_] :=
%t Module[{n = m, d, sign, t = g},
%t If[n != 0, If[n > 0, sign = 1, sign = -1; n = -n];
%t d = Ceiling[Log[3, n]]; If[3^d - n <= ((3^d - 1)/2), d++];
%t While[Length[t] < d, PrependTo[t, 0]];
%t t[[Length[t] + 1 - d]] = sign;
%t t = BTDigits[sign*(n - 3^(d - 1)), t]]; t];
%t (* This calculates j and k for balanced ternary form of number m. *)
%t BTnonzeroNumofDigits[m_Integer] :=
%t Module[{n = m}, t = BTDigits[n, {}]; j = Length[t];
%t k = 0; Do[If[t[[i]] != 0, k++], {i, 1, j}];
%t k = (k - 1)/2; {j, k}];
%t (* This calculates the category index n as defined in A277513 for a {j,k} pair. *)
%t IndexA277513[{j_, k_}] :=
%t Module[{m, i},
%t If[OddQ[j], m = (j - 1)/2; i = m^2 - m + k, m = j/2;
%t i = m^2 - 2 m + 1 + k]];
%t (* This counts a(n). *)
%t p=3;a={} ;While[p = NextPrime[p]; jk = BTnonzeroNumofDigits[p]; jk[[1]] <= 15, id = IndexA277513[jk]; While[Length[a] < id, AppendTo[a, 0]];
%t a[[id]]++];a
%Y 2 together with the column 1 gives A196698.
%Y Cf. A277513, A134023.
%K nonn,base,tabf
%O 3,1
%A _Lei Zhou_, Oct 18 2016