# Is it almost-prime?

Sandbox

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 so the shortest answer in bytes wins!

• To clarify: the truthy and falsy values need not be consistent, right? – Luis Mendo Aug 26 '20 at 0:42
• This is A000961 in the OEIS. – Giuseppe Aug 26 '20 at 13:21
• The usual name for this kind of number is "prime power". – Andreas Rejbrand Aug 26 '20 at 17:39
• It feels odd to me that you include prime numbers as being "almost prime," but this is still a good challenge! :) – Captain Man Aug 26 '20 at 18:26
• This should use the terminology "prime power". en.wikipedia.org/wiki/Almost_prime already has a definition. – qwr Aug 28 '20 at 5:27

# 05AB1E, 2 bytes

fg


Try it online!

fg  # full program
g  # number of...
f   # prime factors of...
# implicit input
# implicit output