dxnge

22

Dec 6th, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. def f(n):
  2.     if n < 2:
  3.         return n
  4.     if n % 2 == 0:
  5.         return f(n//2) + 1
  6.     else:
  7.         return f(3*n + 1) + 1
  8.  
  9.  
  10. cnt = 0
  11. for i in range(1, 101):
  12.     if f(i) > 100:
  13.         cnt += 1
  14. print(cnt)
  15.  
Advertisement
Add Comment
Please, Sign In to add comment