Projet

Général

Profil

Publication de fichiers » syracuse.py

François Brucker, 03/09/2015 15:22

 


def syracure_suivant(nombre):
if nombre % 2 == 0:
return nombre / 2
else:
return 3 * nombre + 1


def jusqu_a_un(nombre_initial):
nombre_iteration = 0
nombre_courant = nombre_initial

while nombre_courant != 1:
nombre_courant = syracure_suivant(nombre_courant)
nombre_iteration += 1

return nombre_iteration


for nombre in range(1, 1337 + 1):
print("nombre initial", nombre,
"nombre d'itérarions avant 1", jusqu_a_un(nombre))
(3-3/4)