fork download
  1. import time
  2. import random
  3.  
  4. start = time.time()
  5.  
  6.  
  7. def fib_gen(max):
  8. a, b = 1, 1
  9. yield 1
  10. while a < max:
  11. yield a
  12. a, b = a + b, a
  13.  
  14.  
  15. def zeck_representation(num):
  16. gen_array = list(fib_gen(num))
  17. find_num = num
  18. zeck_array = []
  19. while find_num > 0:
  20. zeck_array.append(gen_array[-1])
  21. find_num -= gen_array[-1]
  22. for i in range(0, len(gen_array) - 1):
  23. if gen_array[i] > find_num:
  24. gen_array = gen_array[:i]
  25. break
  26. output = str(num) + ' = '
  27. zeck_array = ' + '.join(str(i) for i in zeck_array)
  28. output += zeck_array
  29. return output
  30.  
  31. challenge = []
  32. [challenge.append(random.randrange(100000000, 100000000000)) for i in range(0, 10)]
  33. [print(zeck_representation(x)) for x in challenge]
  34.  
  35. print("--- %s seconds ---" % (time.time() - start))
Success #stdin #stdout 0.01s 12368KB
stdin
Standard input is empty
stdout
14166057379 = 12586269025 + 1134903170 + 433494437 + 9227465 + 1346269 + 514229 + 196418 + 75025 + 28657 + 2584 + 89 + 8 + 3
35431734809 = 32951280099 + 1836311903 + 433494437 + 165580141 + 39088169 + 5702887 + 196418 + 75025 + 4181 + 987 + 377 + 144 + 34 + 5 + 2
18357790368 = 12586269025 + 4807526976 + 701408733 + 165580141 + 63245986 + 24157817 + 9227465 + 317811 + 46368 + 6765 + 2584 + 610 + 55 + 21 + 8 + 3
39066423096 = 32951280099 + 4807526976 + 1134903170 + 165580141 + 5702887 + 1346269 + 75025 + 6765 + 1597 + 144 + 21 + 2
27814677130 = 20365011074 + 4807526976 + 1836311903 + 701408733 + 102334155 + 1346269 + 514229 + 196418 + 17711 + 6765 + 2584 + 233 + 55 + 21 + 3 + 1
84949855652 = 53316291173 + 20365011074 + 7778742049 + 2971215073 + 433494437 + 63245986 + 14930352 + 5702887 + 832040 + 317811 + 46368 + 17711 + 6765 + 1597 + 233 + 89 + 5 + 2
43205806980 = 32951280099 + 7778742049 + 1836311903 + 433494437 + 165580141 + 39088169 + 832040 + 317811 + 121393 + 28657 + 6765 + 2584 + 610 + 233 + 89
25088247499 = 20365011074 + 2971215073 + 1134903170 + 433494437 + 165580141 + 14930352 + 2178309 + 832040 + 75025 + 17711 + 6765 + 2584 + 610 + 144 + 55 + 8 + 1
3542546343 = 2971215073 + 433494437 + 102334155 + 24157817 + 9227465 + 1346269 + 514229 + 196418 + 46368 + 10946 + 2584 + 377 + 144 + 55 + 5 + 1
18930743274 = 12586269025 + 4807526976 + 1134903170 + 267914296 + 102334155 + 24157817 + 5702887 + 1346269 + 514229 + 46368 + 17711 + 6765 + 2584 + 987 + 34 + 1
--- 0.00037789344787597656 seconds ---