Compare big exponentials

Let's talk about algorithms!

Moderator: Board moderators

Compare big exponentials

Postby mrlinx » Wed May 06, 2009 5:13 am

I stumbled across a problem a long time ago where I was given several exponencial numbers, and was my mission to find the largest. I'm trying to remember what is the best way to solve this... I think there was a property in logarithms that allowed this to be made quite fast, but can't seem to get it to work.

Example, from this list, which is the biggest:
2^3^4^5
6^1^3^6
9^3^2^2
8^8^8^8

Thanks ;)
mrlinx
New poster
 
Posts: 3
Joined: Wed May 06, 2009 5:03 am

Re: Compare big exponentials

Postby sohel » Wed May 06, 2009 9:24 am

I think this should work.

Suppose we are comparing a^b^c and d^e^f,

assume d = a^x
.. x = log(d) / log(a)

and so d^e^f = (a^x)^e^f = a^(xe)^f
then we have to compare b^c with (xe)^f and see which one is bigger!! This can be found using the above method.
User avatar
sohel
Guru
 
Posts: 862
Joined: Thu Jan 30, 2003 5:50 am
Location: University of Texas at San Antonio

Re: Compare big exponentials

Postby mf » Wed May 06, 2009 12:50 pm

sohel wrote:and so d^e^f = (a^x)^e^f = a^(xe)^f

No, (a^x)^e^f = a^(x e^f)
(Remember that exponentiation is right-associative: a^b^c = a^(b^c).)
mf
Guru
 
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland

Re: Compare big exponentials

Postby sohel » Thu May 07, 2009 6:16 am

Oops! You are, of course, right. :)
Then, is there any solution with logarithms, or do we have to bring number theoretic algorithms into action?
User avatar
sohel
Guru
 
Posts: 862
Joined: Thu Jan 30, 2003 5:50 am
Location: University of Texas at San Antonio


Return to Algorithms

Who is online

Users browsing this forum: No registered users and 0 guests