Sieve of Eratosthenes
for ( let i = 2 ; i * i < MAX ; i ++ ) { if ( prime [ i ] ) { for ( let j = i * i ; j < MAX ; j += i ) { prime [ j ] = false ; } } } prefix [ 1 ] = 1 ; suffix [ MAX - 1 ] = 1e9 + 7 ;