#include #include using namespace std; static bool isPrime(long i) { for (long test = 2; test < i; test++) { if (i%test == 0) { return false; } } return true; } const int n_loops = 10000; int main() { hrtime_t t_start = gethrtime(); long n_primes = 0; for (long i = 0; i < n_loops; i++) { if (isPrime(i)) { n_primes++; } } hrtime_t t_end = gethrtime(); cout << (t_end - t_start)/1000000 << " "; return 1; }