[Math] Computing a very large number

calculatorelementary-number-theory

I've been making a program that can delay for any number of nanoseconds 0-65534 to any power 0-65534. That is to say, the shortest possible delay is 0^0 nanoseconds (1) and the longest possible delay is 65534^65534 nanoseconds (?). My problem is this: How can I discover the value of 65534^65534? I need this for several reasons, mainly documenting the behavior and telling the user the maximum possible delay. All calculators I've used have either given me an error such as OVERFLOW or Invalid input or simply said Infinity. I don't care about practicality; I'm sure this will work out to be millennia or something so ridiculous. I just want a straightforward answer, and, if possible, please stay away from using scientific notation

Also, I don't want to hear something like "Just write it out", because I'm not about to multiply any number by itself 65534 times.

Best Answer

Millennia is a short and cozy term here. We're talking about a something like a googol googol googol ... googol googols times the age of the universe. (In other words, your program can't count that long on any real hardware before the heat death of the universe cuts off the power; I don't think the universe would have room for the stupendous amounts of entropy that would be produced by even a single clock running for that many steps).

The best you can hope for is to express the number in exponential notation -- that is, take its logarithm: $$\log(65534^{65534}) = 65534\times \log(65534) = 315{,}642.327$$ So the answer is about $10^{315{,}633}$ seconds.

If you want to stay away from scientific notation, do you really want to write a number with three hundred thousand digits in your manual?

Related Question