Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Printing googolplex
#1
Hi. I am trying to write a program that will print the number googol plex (1 followed by a googol(1 followed by 100 zeros)zeros). However, when I run the code the interface is blank. Here is my code:
number_googol="1"
number_googolplex="1"
r_t=0
r_t1=0
zero="0"

while (r_t<100):
    number_googol=number_googol + zero
    r_t=r_t+1
    

while (r_t1<int(number_googol)):
    number_googolplex=number_googolplex + zero
    r_t1=r_t1 +1

if (r_t1 == int(number_googol)):
    print(number_googolplex)
    
     
I encountered no errors trying to run the code.
Can anyone help?
Reply
#2
it's because your second loop is running googol times and it takes a long time :) I don't think it's possible to print such a large number - https://www.physicsforums.com/threads/ho...ex.690823/
Reply
#3
The following program prints googolplex
# python 3 script to print the number googolplex
import sys
w = sys.stdout.write
f = sys.stdout.flush
s = '0' * 100

w('1')
for i in range(10**98):
    w(s)
    f()
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020