Created
May 17, 2012 04:00
-
-
Save de1o/2716186 to your computer and use it in GitHub Desktop.
colazCalculatingTime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# colazCalculatingTime.py | |
import time | |
colazStopNumList = [] | |
def colaz(n, cnt): | |
if n == 1: | |
colazStopNumList.append(cnt) | |
return 0 | |
if n % 2 == 0: | |
n = n/2 | |
else: | |
n = 3*n + 1 | |
colaz(n, cnt+1) | |
startTime = time.clock() | |
for i in range(65536): | |
colaz(i+1, 0) | |
print (time.clock() - startTime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment