Semiprime numbers are natural numbers that are products of exactly two (possibly equal) prime numbers.


Semiprimes   are also known as:

   semi-primes
   biprimes
   bi-primes
    2-almost    primes
   or simply:    P2  


Example
 
   1679  =  23 × 73  

(This particular number was chosen as the length of the Arecibo message).



Task

Write a function determining whether a given number is semiprime.



See also

 The Wikipedia article:  semiprime.
 The Wikipedia article:  almost prime.
 The OEIS sequence:  A001358: semiprimes  which has a shorter definition: the product of two primes.


 
// Semiprime
 
function primeFactorsCount(n: number): number {
  n = Math.abs(n);
  var count = 0; // Result
  if (n >= 2)
    for (factor = 2; factor <= n; factor++) 
      while n % factor == 0) {
        count++;
        n /= factor;
      }
  return count;
}
 
const readline = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
 
readline.question('Enter an integer: ', sn => {
  var n = parseInt(sn);
  console.log(primeFactorsCount(n) == 2 ? 
    "It is a semiprime." : "It is not a semiprime.");
  readline.close();
});
 