int main() {
int i, a[N];
// initialize the array
for(i = 2; i < N; i++) a[i] = 1;
for(i = 2; i < N; i++)
if(a[i])
for(int j = i; j*i < N; j++) a[i*j] =0;
// pirnt the primes less then N
for(i = 2; i < N; i++)
if(a[i]) cout << " " << i;
cout << endl;
}
It was given in algorithm book i am reading running time of above program is proportional to N+N/2+N/3+N/5+N/7+N/11+...
,
Please help me in understanding how author came up with above equation from the program. Thanks! Venkata