Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

$b^n$ where the base $b$ is a positive integer greater than $1$ and the exponent $n$ is a rational number in simplified form. How would one compare (resulting in <, =, or >) two such exponentiations without evaluating the exponentiatoins, and without the use of functions or operations that produce real numbers (e.g., log(), pow(), etc)?

share|cite|improve this question
As in comparing $b^n$ and $c^m$ ? different bases and different exponents? – Rustyn Dec 28 '12 at 7:07
I do not understand what is being asked. Could you please elaborate? What do you mean by compare? – Jonas Meyer Dec 28 '12 at 7:08
if $gcd(b,c)=1$ can the two numbers be equal? – Rustyn Dec 28 '12 at 7:14
I give an algorithm for exactly this problem in this question:… – mjqxxxx Dec 28 '12 at 7:21
@RustynYazdanpour I don't know. – Arlen Dec 28 '12 at 9:07

In order to compare, say, $b_{1}^{p_{1}/q_{1}}$ and $b_2^{p_2/q_2}$, the simplest approach is to raise both to the same power ($q_1 q_2$) and compare the resulting integers, $b_{1}^{p_1 q_2}$ and $b_2^{p_2 q_1}$.

share|cite|improve this answer
That won't work for all cases because the exponents can be negative rationals. Besides, I forgot to mention in my question, I can't evaluate the exponentiation because it can easily overflow. – Arlen Dec 28 '12 at 21:25
If both exponents are negative, do the comparison with positive exponents and return the opposite result. If one is negative and the other non-negative, then the one with the negative exponent is smaller. And you need, I think, to be able to use either big integers or floating-point numbers to do this problem. – mjqxxxx Dec 28 '12 at 21:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.