Skip to content

Instantly share code, notes, and snippets.

@FiloSottile
Last active December 27, 2015 03:18
Show Gist options
  • Save FiloSottile/7257960 to your computer and use it in GitHub Desktop.
Save FiloSottile/7257960 to your computer and use it in GitHub Desktop.
>>> def F(n):
... x = 1
... while True:
... if n == 1: return x
... elif n % 2 == 0: n /= 2
... else: n = n * 3 + 1
... x += 1
>>> input = 1429
>>> max(range(1, input+1), key=F)
1161
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment