Exactly Three

Published by Mubashir Hassan in

You are given a number n. Determine whether n has exactly 3 divisors or not.

Examples

is_exactly_three(4) ➞ true
# 4 has only 3 divisors: 1, 2 and 4

is_exactly_three(12) ➞ false
# 12 has 6 divisors: 1, 2, 3, 4, 6, 12

is_exactly_three(25) ➞ true
# 25 has only 3 divisors: 1, 5, 25

Notes

1 ≤ n ≤ 10^12

Watch a quick demo on how Edabit works.