Advertisement
DecaK

Untitled

Dec 9th, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. def f(n, brojac=0):
  2. if n == 1:
  3. return brojac
  4. elif n % 2 == 0:
  5. return f(n // 2, brojac + 1)
  6. else:
  7. return f(3 * n + 1, brojac + 1)
  8.  
  9. print(f(15))
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement