/* Counting Fractions Consider the fraction, n/d, where n and d are positive integers. If n using namespace std; const int MAX = 1000000; int main(){ cout << "Hello this is Patrick" << endl; auto start = chrono::high_resolution_clock::now(); vector phi(MAX + 1); for(int i = 2; i <= MAX; ++i){ phi[i] = i; } long long sum = 0; for(int i = 2; i <= MAX; ++i){ if(phi[i] == i){ for(int j = i; j <= MAX; j += i){ phi[j] = phi[j] / i * (i - 1); } } sum += phi[i]; } cout << sum << endl; auto duration = chrono::duration_cast(chrono::high_resolution_clock::now() - start); cout << (float)duration.count()/1000 << endl; return 0; }