sieve method for storing a list of prime
function SieveOfEratosthenes ( ) { for ( var p = 2 ; p * p <= MAX ; p ++ ) if ( prime [ p ] == true ) for ( var i = p * 2 ; i <= MAX ; i += p ) prime [ i ] = false ; }