fork(1) download
  1. from functools import reduce
  2. from time import time
  3.  
  4. def gcd(a, b):
  5. while b:
  6. a, b = b, a%b
  7. return a
  8.  
  9. def lcm(a, b):
  10. return a * b // gcd(a, b)
  11.  
  12.  
  13. t1 = time()
  14. print(reduce(lcm, range(1, 21)))
  15. t2 = time()
  16. print("time elapsed:", t2 - t1)
  17.  
Success #stdin #stdout 0.03s 9440KB
stdin
Standard input is empty
stdout
232792560
time elapsed: 4.1961669921875e-05