A276982 a(n) = number of primes p whose balanced ternary representation is compatible with the binary representation of A276194(n).
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
Offset: 1
Examples
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.
Links
- Lei Zhou, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A276194.
Programs
-
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}]
Extensions
Edited by N. J. A. Sloane, Nov 05 2016
Comments