galois.is_perfect_power

galois.is_perfect_power(n)

Determines if \(n\) is a perfect power \(n = x^k\) for \(x > 0\) and \(k \ge 2\).

Parameters

n (int) – A positive integer.

Returns

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

Return type

bool

Examples

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

In [2]: galois.is_perfect_power(16)
Out[2]: True

In [3]: galois.is_perfect_power(20)
Out[3]: False