Calculating phi(k) for 1<k<N
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 10 12 ) Is it possible? If so, how? RBarryYoung This can be done with Memory complexity O(Sqrt(N)) and CPU complexity O(N * Log(Log(N))) with an optimized windowed Sieve of Eratosthenes, as implemented in the code example below. As no language was specified and as I do not know Python, I have implemented it in VB.net, however I can convert it to C# if you need that. Imports System.Math Public Class