Definition: A positive integer n
is almost-prime, if it can be written in the form n=p^k
where p
is a prime and k
is also a positive integers. In other words, the prime factorization of n
contains only the same number.
Input: A positive integer 2<=n<=2^31-1
Output: a truthy value, if n
is almost-prime, and a falsy value, if not.
Truthy Test Cases:
2
3
4
8
9
16
25
27
32
49
64
81
1331
2401
4913
6859
279841
531441
1173481
7890481
40353607
7528289
Falsy Test Cases
6
12
36
54
1938
5814
175560
9999999
17294403
Please do not use standard loopholes. This is code-golf so the shortest answer in bytes wins!