login
a(n) = number of primes p whose balanced ternary representation is compatible with the binary representation of A276194(n).
1

%I #45 Feb 27 2020 20:52:22

%S 4,6,8,10,10,10,7,19,18,16,19,17,16,11,20,19,21,22,21,19,30,21,22,23,

%T 30,22,30,30,30,7,24,27,23,28,24,29,45,25,29,20,53,28,50,45,50,30,24,

%U 25,48,25,45,40,45,26,53,48,53,45,50,45,10,27,26,32,24,26

%N a(n) = number of primes p whose balanced ternary representation is compatible with the binary representation of A276194(n).

%C Let B = binary representation of A276194(n), and let C = C(p) = balanced ternary (bt) representation of a prime p (see A117966). Thus C is a string of 0's, 1's, and -1's. We will write T instead of -1.

%C We say that C is compatible with B if (i) length(C) = length(B); (ii) C has a 1 or T wherever B has a 1; and (iii) there is exactly one 1 or T in C in the positions where B is 0, and otherwise C has a 0 whenever B has a 0.

%C Then a(n) is the number of primes p for which C(p) is compatible with B.

%C It is conjectured that all a(n) > 0. This has been checked for n <= 100000. But it is possible that there is a counterexample for very large n.

%H Lei Zhou, <a href="/A276982/b276982.txt">Table of n, a(n) for n = 1..10000</a>

%e n=1, A276194(1) = 5, or 101 in binary form. Using this as mask to generate positive balanced ternary numbers that allow 1 or T on all 1 digits, but only one digits 1 or T falls on a 0 digits, the following balanced ternary numbers can be generated: 1TT=5, 1T1=7, 11T=11, 111=13. All the four numbers are primes. So a(1)=4.

%e n=2, A276194(2) = 9, or 1001 in binary form. Using this as mask to generate positive balanced ternary numbers that allow 1 or T on all 1 digits, but only one digits 1 or T falls on a 0 digits, the following balanced ternary numbers can be generated: 1T0T=17, 1T01=19, 10TT=23, 10T1=25, 101T=29, 1011=31, 110T=35, 1101=37. Among the 8 numbers, 6 of them (17, 19, 23, 29, 31, and 37) are primes. So a(2)=6.

%t BNDigits[m_Integer] := Module[{n = m, d, t = {}},

%t While[n > 0, d = Mod[n, 2]; PrependTo[t, d]; n = (n - d)/2]; t];

%t c = 1;

%t Table[ While[c = c + 2; d = BNDigits[c]; ld = Length[d];

%t c1 = Total[d]; !(EvenQ[c1] && (c1 < ld))];

%t l = Length[d]; flps = Flatten[Position[Reverse[d], 1]] - 1;

%t flps = Delete[flps, Length[flps]];

%t sfts = Flatten[Position[Reverse[d], 0]] - 1; lf = Length[flps]; ls = Length[sfts]; ct = 0;

%t Do[Do[cp10 = 3^(l - 1) + 3^(sfts[[i]]);

%t cp20 = 3^(l - 1) - 3^(sfts[[i]]); di = BNDigits[j];

%t While[Length[di] < lf, PrependTo[di, 0]]; Do[

%t If[di[[k]] == 0, cp10 = cp10 - 3^flps[[k]];

%t cp20 = cp20 - 3^flps[[k]], cp10 = cp10 + 3^flps[[k]];

%t cp20 = cp20 + 3^flps[[k]]], {k, 1, lf}];

%t If[PrimeQ[cp10], ct++]; If[PrimeQ[cp20], ct++], {j, 0, 2^lf - 1}], {i, 1, ls}]; ct, {n, 1, 66}]

%Y Cf. A276194.

%K nonn,base

%O 1,1

%A _Lei Zhou_, Oct 20 2016

%E Edited by _N. J. A. Sloane_, Nov 05 2016