id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

isPerfectPower


Complete the function that when passed an integer (say, n), returns True if it is a "perfect power", that is, there exist two integers, k and p, such that p > 1, and k to the power of p = n. Note: 0 and 1 are considered perfect powers since 0 to the power of any value is 0, and 1 to the power of any value is 1.


isPerfectPower(6561) → true
isPerfectPower(80) → false
isPerfectPower(0) → true

...Save, Compile, Run (ctrl-enter)

boolean isPerfectPower(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 4 Post-solution available

Copyright Nick Parlante 2017 - privacy