Skip to content

Instantly share code, notes, and snippets.

@aeberspaecher
Created January 20, 2012 10:02
Show Gist options
  • Save aeberspaecher/1646520 to your computer and use it in GitHub Desktop.
Save aeberspaecher/1646520 to your computer and use it in GitHub Desktop.
Run the Hailstone code
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