Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def collatz(n):
- times = 0
- while n != 1:
- times += 1
- if n % 2 == 0:
- n /= 2
- else:
- n *= 3
- n += 1
- return times
- collatz(11)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement