/*
* The changes needed to the problem are minor:Istead of printing rhe primes,they are counted.
* 2010-11-20
*/
/*
* Go through the entire sieve now and count how many primes there are
* per thousand numbers.
*/
n_primes = 1; limit = 1000;
for( bit_number = 0, number = 3; number <= MAX_VALUE; bit_number += 1, number += 2 ) { if( test_bit( sieve, bit_number ) ) { printf( "%d-%d: %d\n", limit - 1000, limit, n_primes ); n_primes = 0; limit += 1000; } if( test_bit( sieve, bit_number ) ) n_primes += 1; } printf( "%d-%d: %d\n", limit - 1000, limit, n_primes );
|
阅读(1278) | 评论(0) | 转发(0) |