Correct answer: B
Solution: “P only if Q” means P ⇒ Q. Here P is “the number is prime” and Q is “it has exactly two positive factors”.