top of page
Click here to go to the home page of AskTheCode.

Collatz Conjecture in Python - Python Programming Essentials | AskTheCode

Based on question asked in Python Programming Essentials course on Coursera | Week 3 solution code | Simple python program on Collatz Conjecture | Python

def f(n):

return n // 2 if n % 2 == 0 else 3*n + 1


print (f(f(f(f(f(f(f(f(f(f(f(f(f(f(1071)))))))))))))))


Recent Posts

See All

Comments


bottom of page