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.


 
prime = 1679
decomp(prime)
 
func decomp nr
x = ""
sum = 0
for i = 1 to nr
    if isPrime(i) and nr % i = 0
       sum = sum + 1
       x = x + string(i) + " * " ok
    if i = nr and sum = 2
       x2 = substr(x,1,(len(x)-2))
       see string(nr) + " = " + x2 + "is semiprime" + nl 
    but i = nr and sum != 2 see string(nr) + " is not semiprime" + nl ok
next
 
func isPrime n
     if n < 2 return false ok
     if n < 4 return true ok
     if n % 2 = 0 and n != 2 return false ok
     for d = 3 to sqrt(n) step 2 
         if n % d = 0 return false ok
     next	
     return true
 