for (k = 3; k <= n; k++) // This assigns 0 to all elements from 3rd element to the nth element
A[k] = 0;
for (k = 2; k <= TwoLog_n; k++) // Runs from 2 to 2logn
for (j = k+1; j <= n; j++) // runs from k + 1 to n
A[j] = A[j] || (j%k); // Assigns A[j]=1 if it is already 1 or if j is not divisible by k
what this loop essentially does is it makes A[j] equal to 1 if j is divisible by at least one of 2,3,...,2logn
for k = 2
j = 3, 4, 5, ..., n | A[4] = 1, A[6] = 1 all even indices become 1
for k = 3
j = 4, 5, 6, ... , n | A[6] = 1, A[9] = 1, ... all j divisible by 3 becomes 1
This pattern continues until k = 2logn
So for A[j] to be 0, j should be divisible by all of k = 2,3,4,5,....2logn
The lowest value of j = LCM (2,3,4,5,...2logn) >= Product of all primes in (2,3,4,5,...,2logn) > n
Lowest value of j > n
It is not possible to get a 0 uptil n as the lowest value where we would get A[j] = 0 is when j > n