Product of Two Prime Numbers

Published by Matt in

Write a function that returns true if the given number num is a product of any two prime numbers.

Examples

product_of_primes(2059) ➞ true
# 29*71=2059

product_of_primes(10) ➞ true
# 2*5=10

product_of_primes(25) ➞ true
# 5*5=25

product_of_primes(999) ➞ false
# There are no prime numbers.

Notes

  • num is always greater than 0.
  • 0 and 1 aren't prime numbers.
Watch a quick demo on how Edabit works.