title: What is the fastest way to determine n^m = m^n if m != n?
body: <p>It's one of the questions from the practice section in hackerearth. We need to determine whether m^n = n^m. It is trivial when n = m, so we focus on m != n.</p>
  
  <pre><code>1 &lt;= m, n &lt;= 10^10000
  </code></pre>
  
  <p>What I have tried is </p>
  
  <pre><code>n^m = m^n  implies
  m*log(n) = n*log(m)
  </code></pre>
  
  <p>But the problem is how to take log of such a huge number? Is there an alternative way of checking equality?</p>