Advertisement
lecram

Chalsequence

Feb 26th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. import math
  2.  
  3. sawtooth = lambda x: math.modf(x)[0]
  4.  
  5. lg3 = math.log(5, 4)
  6.  
  7. limit = 1
  8. i = 1
  9. m = 1
  10. lgt = sawtooth(lg3)
  11. running = True
  12. while running:
  13.     try:
  14.         while lgt >= limit:
  15.             lgt = sawtooth(lgt + lg3)
  16.             m += 1
  17.         print("%d\t%d" % (i, m))
  18.         limit = lgt
  19.         i += 1
  20.     except KeyboardInterrupt:
  21.         running = False
  22. print("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement