Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Determine whether a given integer is a perfect power
ResourceFunction["PerfectPowerQ"][n,k] yields True if n is the kth power of some integer greater than 1 where k≥2. |
Test whether 100 can be expressed as a perfect power:
In[1]:= |
Out[1]= |
List of all perfect powers up to 105:
In[2]:= |
Out[2]= |
When a second argument k is passed, PerfectPowerQ checks whether n can be represented as the perfect kth power of some integer greater than one:
In[3]:= |
Out[3]= |
The first few perfect powers without duplications are 1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100, 121, 125, … (OEIS A001597). Even more amazingly, the sum of the reciprocals of these numbers (excluding 1) is given by (OEIS A072102), where μ(k) is the Möbius function (MoebiusMu) and ζ(k) is the Riemann zeta function (Zeta).
This can be verified with the PerfectPowerQ function:
In[4]:= |
In[5]:= |
Out[5]= |
The first argument should be an integer greater than 1:
In[6]:= |
Out[6]= |
The second argument, if given, should be greater than or equal to 2:
In[7]:= |
Out[7]= |
This work is licensed under a Creative Commons Attribution 4.0 International License