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=rkn = r^k with k≥2k \ge 2, returns kk and sets *root to rr; otherwise returns 0. Both 0 and 1 count as squares. The kk 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-11-02).