Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 575 Bytes

PerfectPowerAlgorithm.md

File metadata and controls

21 lines (16 loc) · 575 Bytes

PerfectPowerAlgorithm

Finds the root and the exponent for a given natural number n

To use this class, just write PerfectPowerAlgorithm.isPerfectPower(n) inside the main class

public int[] isPerfectPower(int n) {
        //returns the result in a array form of size two
}

Example code, for understanding:

public static void main(String[] args){
        PerfectPowerAlgorithm perfectPower = new PerfectPowerAlgorithm();
        System.out.println(perfectPower.isPerfectPower(0));
        // returns int array of size two or null otherwise
}