Given a large N, I need to iterate through all phi(k) such that 1 < k < N :

* time-complexity must be `O(N logN)`
* memory-complexity must be sub `O(N)` (since the values of N will be around 1012)

Is it possible? If so, how?