def f(x): return 3*x+1 def somme_recurrente(debut,fin,u_p): s=u_p u=u_p for i in range(debut,fin): u=f(u) s=s+u return s