FLINT3.7.0-dev

n_is_perfect_power

Synopsis#include <flint/ulong_extras.h>
int n_is_perfect_power(ulong * root, ulong n)source

If n = r^k with k \ge 2, returns k and sets *root to r; otherwise returns 0. Both 0 and 1 count as squares. The k found is not necessarily the largest possible.

Cite this page

The FLINT team, “n_is_perfect_power (ulong_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ulong_extras/n_is_perfect_power.html (generated 2026-10-20).