Pre - computation of smallest prime divisor of all numbers
function sieveOfEratosthenes ( ) { for ( let i = 2 ; i * i < MAX ; ++ i ) { if ( primedivisor [ i ] == 0 ) { for ( let j = i * i ; j < MAX ; j += i ) { primedivisor [ j ] = i ; } } }