(adsbygoogle = window.adsbygoogle || []).push({}); What's the quickest way to check if an integer is a perfect power?

I want to write a program that checks whether a consumed positive integer, n, is a perfect power or not. What would be the most efficient implementation of that program? I can think of an obvious implementation (checking if all 0 < i <= n/2 are power roots of n), but I'm rusty on number theory so I'm not sure if there exists a better way. I wouldn't want to get into case analysis, but if the gains in efficiency are significant, I'd consider it.

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# What's the quickest way to check if an interger is a perfect power?

Loading...

Similar Threads - What's quickest check | Date |
---|---|

I What is the symbol for "not necessarily imply" | Mar 11, 2018 |

I What is dx | Mar 7, 2018 |

I What does the vertical line in this equation mean? | Feb 28, 2018 |

B What is the name of this triangular geometric shape? | Feb 20, 2018 |

What is the quickest way for you to count to 20 using only the fingers of your hands? | Mar 22, 2012 |

**Physics Forums - The Fusion of Science and Community**