galois.is_prime_power(n: int) bool

Determines if \(n\) is a prime power \(n = p^k\) for prime \(p\) and \(k \ge 1\).

Parameters
n: int

An integer.

Returns

True if the integer \(n\) is a prime power.

Notes

There is some controversy over whether 1 is a prime power \(p^0\). Since 1 is the 0-th power of all primes, it is often regarded not as a prime power. This function returns False for 1.

Examples

In [1]: galois.is_prime_power(8)
Out[1]: True

In [2]: galois.is_prime_power(6)
Out[2]: False

In [3]: galois.is_prime_power(1)
Out[3]: False