Function to generate the prime numbers using Sieve of Eratosthenes
function buildSieve ( sum ) { prime = Array ( sum + 1 ) . fill ( true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( var p = 2 ; p * p < ( sum + 1 ) ; p ++ ) {