title: what is the time complexity of this method which checks if a number k can be represented as n^p
body: <p>Time complexity of below method? I'm calculating it as log(n)*log(n)= <strong>log(n)</strong> </p>
  
  <pre><code>public int isPower(int A) {
      if (A == 1) 
          return 1;
  
      for (int i = (int)Math.sqrt(A); i &gt; 1; i--){
          int p = A;
  
          while (p % i == 0) {
              p = p / i;
          }
  
          if (p == 1) 
              return 1;
      }
  
      return 0;
  }
  </code></pre>