# Question 1: def tempsdevol(c): u, n = c, 0 while u != 1: if u % 2: u = 3*u + 1 else: u = u//2 n += 1 return n # Question 2 def altitude(c): u, umax = c, c while u != 1: if u % 2: u = 3*u + 1 else: u = u//2 if u > umax: umax = u return umax # Question 3 # a) def tempsdarret(c): u, n, nmax = c, 0, 0 while u != 1: n += 1 if u % 2: u = 3*u + 1 else: u = u//2 if u >= c: nmax = n return nmax # b) import time def verification(m):# m=1000000 -> 60 sec start = time.time() for c in range(2, m+1): tempsdarret(c) return time.time() - start