Function to check if a number is a prime or not
function isPrime ( N ) { if ( N <= 1 ) return false ; for ( let i = 2 ; i <= Math . sqrt ( N ) ; i ++ ) { if ( N % i == 0 ) return false ; } return true ; }