P(x) returns:
true if the number of 1 bits set in the
binary representation of x is prime,
false otherwise.
Next, consider the following function prime_bits:
uint64_t prime_bits(uint64_t a, uint64_t b);
Your implementation should be efficient, and it should be wrapped up nicely such that one can specify a and b on the commandline when running your program. You may expect the range of a and b to be limited to non-negative 64-bit integers, though it would certainly be uncouth for your algorithm to break down for larger values.
Your implementation should have a running time faster than O(n), where n is b - a.

1 comment:
Oi, achei teu blog pelo google tá bem interessante gostei desse post. Quando der dá uma passada pelo meu blog, é sobre camisetas personalizadas, mostra passo a passo como criar uma camiseta personalizada bem maneira. Se você quiser linkar meu blog no seu eu ficaria agradecido, até mais e sucesso. (If you speak English can see the version in English of the Camiseta Personalizada. If he will be possible add my blog in your blogroll I thankful, bye friend).
Post a Comment