Fastest way to check if $x^y > y^x$?

13.8k Views Asked by At

What is the fastest way to check if $x^y > y^x$ if I were writing a computer program to do that?

The issue is that $x$ and $y$ can be very large.

2

There are 2 best solutions below

11
On BEST ANSWER

If both $x$ and $y$ are positive then you can just check: $$ \frac{\log(x)}{x} \gt \frac{\log(y)}{y}$$ so if both $x$ and $y$ are greater than $e \approx 2.7183$ then you can just check: $$x \lt y$$

0
On

You might get by testing whether $y \log x > x \log y$, especially if the numbers are only moderately large.