login
A158671
Frequency of 0's in a constant bit representation of primes.
1
1, 4, 10, 23, 47, 100, 202, 403, 798, 1592, 3171, 6293, 12578, 24987, 49796, 99190, 197699, 394227, 785804, 1567419, 3127966, 6242519, 12464093, 24887586, 49698098, 99261034, 198285886
OFFSET
2,2
COMMENTS
From Table 1, p. 2, of Kak.
EXAMPLE
The number of 0's and 1's for all primes with respect to different binary lengths from 2 to 27 is given in Table 1. Thus for all primes of binary length 3, we have the primes 2, 3, 5, and 7 which in the binary form are 010, 011, 101, and 111, with four 0's and 8 1's, so a(2) = 4. Likewise, for all primes of bit length 4, we count the primes 2, 3, 5, 7, 11, and 13 corresponding to the sequences 0010, 0011, 0101, 0111, 1011, 1101, which gives us ten 0's and 14 1's, so a(3) = 10.
PROG
(PARI) an=0; c=0;
f(n)={i=2^(n-1); j=2^n - 1; z=0; for(k=i, j, if(isprime(k), c++; v=binary(k); L=#v; for(m=1, L, if(v[m]==0, z++)))); return(z)};
an=f(2); print1(an, ", "); for(n=3, 28, an=an+c+f(n); print1(an, ", ")) \\ Washington Bomfim, Jan 19 2011
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Jonathan Vos Post, Mar 24 2009
EXTENSIONS
a(28) from Washington Bomfim, Jan 19 2011
STATUS
approved