A collection of codes containing the solution you are looking for.
A collection of codes containing the solution you are looking for.
function seive(n)
{
//Logic
var is_prime = new Array(n).fill(1);
is_prime[0] = 0;
is_prime[1] = 0;
for(var i = 2; i <= n; i++)
{
if(is_prime[i] == 1);
for(var j = i + i; j <= n; j += i)
is_prime[j] = 0;
}
return is_prime;
}