Computing count of prime numbers using sieve
for ( var i = 2 ; i <= Math . sqrt ( n ) ; i ++ ) { if ( prime [ i ] ) for ( factor = 2 ; factor * i <= n ; factor ++ ) prime [ factor * i ] = false ; } var primeIndices = 0 ; for ( var i = 1 ; i <= n ; i ++ ) if ( prime [ i ] ) primeIndices ++ ; var mod = parseInt ( ( 1e9 + 7 ) ) , res = 1 ;