fork download
  1. import time
  2. import math
  3. start_time = time.time()
  4.  
  5. def num_digits(n):
  6. return math.floor((math.log1p(2 * math.pi * n) / 2 + n * (math.log1p(n) -1)) / math.log1p(10)) + 1
  7.  
  8. print "approximately 10^%d gp" % num_digits(1000000)
  9. print "%f seconds" % (time.time() - start_time)
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
approximately 10^5344487 gp
0.000053 seconds