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)))))))))))))))


23 views0 comments

Recent Posts

See All

Binary string reduction in Python

Asked: Sudeep |Category: Python x=int(input("Enter the value of x : ")) for i in range(x): n=int(input("Enter the value of n : ")) y=input("Enter the value of y : ") l=list(y) k=0

"Believe you can and you're halfway there"