Deciding perfect powers #
Step 1 of the AKS algorithm Agrawal, Kayal, Saxena, Section 4 asks whether n = a ^ b
for some b > 1. For n ≥ 2 such an a is at least 2, so b ≤ log₂ n, and n is a b-th
power exactly when it is the b-th power of its integer b-th root Nat.nthRoot b n. This makes
Cslib.AKS.IsPerfectPower decidable by a bounded search.
Main results #
Cslib.AKS.isPerfectPower_iff_nthRoot: perfect powers through integer roots.Cslib.AKS.decidablePredIsPerfectPower: the resulting decision procedure.
References #
0 and 1 are perfect powers: 0 = 0 ^ 2 and 1 = 1 ^ 2.
@[instance_reducible]
Perfect powers are decidable, by the bounded search of isPerfectPower_iff_nthRoot.