# Large integer power problem

• Aug 6th 2012, 05:24 AM
JollyChap
Large integer power problem
Looking for a way to compare a^b , c^d where a,b,c,d are VERY large integers. Specifically, a,c are prime b,d are any positive integers.
HOWEVER.... I do not want to have to compute a^b or c^d.

Obviously the trivial case: a >= c , b >= d implies a^b >= c^d
and: a <= c , b <= d implies a^b <= c^d

but in the cases: a >=c , b <= d
a <= c, b >= d

how to proceed ?.... my thoughts (and I'm no mathematician).... is that I could just take logs and compare b * log(a), d * log(c), or maybe reduce this by using either base 'a' or 'c' so that a 'log' only occurs on one side of the comparison, but I am really looking for an integer solution if one exists... maybe there is some use in a power expansion or some series for the log, where we can somehow 'see' if it is converging above or below the other side of the inequality. But my maths isn't that good!... I'm just a humble coder......

Cheers.... and thanks for any help with this.