#include #include unsigned long long pi(unsigned long long x) { if(x >= 20000000) return 0; // blow up, but genteelly unsigned long long k = 0; /* this is a brain-dead counting algorithm. */ for(unsigned long long i = 0; i < x; i++) { if( (bittab[i >> 5] & (1UL << (i & 31))) != 0) k++; } return k; }