

A276982


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


1



4, 6, 8, 10, 10, 10, 7, 19, 18, 16, 19, 17, 16, 11, 20, 19, 21, 22, 21, 19, 30, 21, 22, 23, 30, 22, 30, 30, 30, 7, 24, 27, 23, 28, 24, 29, 45, 25, 29, 20, 53, 28, 50, 45, 50, 30, 24, 25, 48, 25, 45, 40, 45, 26, 53, 48, 53, 45, 50, 45, 10, 27, 26, 32, 24, 26
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

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.
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.
Then a(n) is the number of primes p for which C(p) is compatible with B.
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.


LINKS

Lei Zhou, Table of n, a(n) for n = 1..10000


EXAMPLE

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.
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.


MATHEMATICA

BNDigits[m_Integer] := Module[{n = m, d, t = {}},
While[n > 0, d = Mod[n, 2]; PrependTo[t, d]; n = (n  d)/2]; t];
c = 1;
Table[ While[c = c + 2; d = BNDigits[c]; ld = Length[d];
c1 = Total[d]; !(EvenQ[c1] && (c1 < ld))];
l = Length[d]; flps = Flatten[Position[Reverse[d], 1]]  1;
flps = Delete[flps, Length[flps]];
sfts = Flatten[Position[Reverse[d], 0]]  1; lf = Length[flps]; ls = Length[sfts]; ct = 0;
Do[Do[cp10 = 3^(l  1) + 3^(sfts[[i]]);
cp20 = 3^(l  1)  3^(sfts[[i]]); di = BNDigits[j];
While[Length[di] < lf, PrependTo[di, 0]]; Do[
If[di[[k]] == 0, cp10 = cp10  3^flps[[k]];
cp20 = cp20  3^flps[[k]], cp10 = cp10 + 3^flps[[k]];
cp20 = cp20 + 3^flps[[k]]], {k, 1, lf}];
If[PrimeQ[cp10], ct++]; If[PrimeQ[cp20], ct++], {j, 0, 2^lf  1}], {i, 1, ls}]; ct, {n, 1, 66}]


CROSSREFS

Cf. A276194.
Sequence in context: A145256 A087789 A071830 * A340846 A167146 A020891
Adjacent sequences: A276979 A276980 A276981 * A276983 A276984 A276985


KEYWORD

nonn,base


AUTHOR

Lei Zhou, Oct 20 2016


EXTENSIONS

Edited by N. J. A. Sloane, Nov 05 2016


STATUS

approved



