Created
January 20, 2012 10:02
-
-
Save aeberspaecher/1646520 to your computer and use it in GitHub Desktop.
Run the Hailstone code
This file contains hidden or 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
from hailstoneCython import hailstone | |
if __name__ == '__main__': | |
h = hailstone(27) | |
assert len(h)==112 and h[:4]==[27, 82, 41, 124] and h[-4:]==[8, 4, 2, 1] | |
print("Maximum length %i was found for hailstone(%i) for numbers <100,000" % | |
max((len(hailstone(i)), i) for i in range(1,100000))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment