Sieve of Eratosthenese
let sieve = new Array ( parseInt ( N / 2 ) + 1 ) . fill ( 0 ) ; for ( let i = 2 ; i <= N / 2 ; i ++ ) { if ( sieve [ i ] == 0 ) { for ( let j = i * i ; j <= N / 2 ; j += i ) { sieve [ j ] = 1 ; } } }