Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate a googolplex

I was curious, a googolplex is (10^10)^100 (Correction: 10^(10^100)) And I want to calculate this. How can I accomplish this?

In C# using the following code:

Console.WriteLine(Math.Pow(Math.Pow(10, 10), 100));

Literately produced the following result:

Infinity

enter image description here

Also, is it Math.Pow(Math.Pow(10, 10), 100) or Math.Pow(10, Math.Pow(10, 100)) for a googolplex?

I understand that even if something like this is possible to calculate (Which I'm sure it isn't on your everyday computer) it will most likely take an infinite amount of time to complete.

I really need to get out more...

like image 200
Oxymoron Avatar asked Dec 18 '25 09:12

Oxymoron


1 Answers

If you just want to display the value, this should be correct for the length of time which you are around to validate it:

Console.Write("1");
while (true) {
    Console.Write("0");
}

Or, if you want to get more specific, we can do this without any bignum libraries.

Console.Write("1");
const int BIL = 1000000000;
for (int i0=0; i0<10; i0++)
 for (int i1=0; i1<BIL; i1++)
  for (int i2=0; i2<BIL; i2++)
   for (int i3=0; i3<BIL; i3++)
    for (int i4=0; i4<BIL; i4++)
     for (int i5=0; i5<BIL; i5++)
      for (int i6=0; i6<BIL; i6++)
       for (int i7=0; i7<BIL; i7++)
        for (int i8=0; i8<BIL; i8++)
         for (int i9=0; i9<BIL; i9++)
          Console.Write("0");
like image 86
Jonathon Reinhart Avatar answered Dec 19 '25 22:12

Jonathon Reinhart



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!