Function to store the primes
function sieve ( maxEle , prime ) { prime [ 0 ] = prime [ 1 ] = 1 ; for ( var i = 2 ; i * i <= maxEle ; i ++ ) { if ( ! prime [ i ] ) { for ( var j = 2 * i ; j <= maxEle ; j += i ) prime [ j ] = 1 ; } } }