function to detect prime number here we have used sieve method https : www . geeksforgeeks . org / sieve - of - eratosthenes / to detect prime number
function sieve ( n , prime ) { for ( let p = 2 ; p * p <= n ; p ++ ) {