Skip to content

Instantly share code, notes, and snippets.

@shieldsd
Created March 16, 2012 09:58
Show Gist options
  • Save shieldsd/2049351 to your computer and use it in GitHub Desktop.
Save shieldsd/2049351 to your computer and use it in GitHub Desktop.
Project Euler #14
def hotpo(n):
steps = 0
while n > 1:
if n % 2 == 0:
n = n / 2
else:
n = 3 * n + 1
steps += 1
return steps
print max((hotpo(i), i) for i in range(1, 1000000))[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment