I am wondering if there is an easy way to calculate the difference of two exponents, with different bases, without calculating the number.
If I have $a^b$ - $c^d$, where $c^{d+1} \gt a^b \ge c^d$ where $a$, $b$, $c$ and $d$ are integers.
For example (with small numbers): $16^6 - 2^{24} = 0$, while $15^7 - 2^{24} = 154082159$.
I have found that the log base conversion $d = ceil(a * log(b) / log(c))$, but I cannot figure out if or how to calculate the difference of the powers.
I have looked and cannot find anything beyond difference of squares.
Thank you.
If your two exponents ($b$ and $d$) are even, then you can consider each number in the difference to be a square and thus potentially reduce the sizes of the numbers you are working with considerably, using difference of squares factorization. Also, if both of your exponents are divisible by 3, you can consider each power to be a cube and then note $A^3-B^3 = (A - B)(A^2 + AB + B^2)$. This can similarly reduce the magnitudes of the numbers you are working with, with only a few extra operations. However, beyond that, I think the only thing you can really use is the generalization given by Theo Bendit in the comment, which will be harder and harder to be applicable as $n$ increases, because you need both $b$ and $d$ to be divisible by $n$, and furthermore, the formula involves considerably more terms to calculate as $n$ increases, whereas single powers can be computed very quickly with successive squaring.
UPDATE: If you know your answer is pretty small, using approximations or whatever method to get a bound, then you can use the Chinese remainder theorem to arrive at your answer, simply by computing your difference of powers modulo a few rather small primes (which is easy, even for large powers, while keeping the numbers in your calculations small, by successive squaring for each power and iteratively computing and storing the remainder of each successive square modulo the prime). All you need to guarantee is that the product of primes you use is larger than the actual answer (which is why it's most beneficial when you know your answer is small magnitude).