isPrime
of length n
with True
(except for indices 0 and 1 which are False
).p = 2
.2
to sqrt(n)
and the inner loop marks the multiples of p
as False
.p*p
up to n
in increments of p
.p
, find the next number greater than p
that is not marked and set p
to this new number.p
exceeds sqrt(n)
.True
values in the isPrime
array, which represents the number of primes less than n
.