PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def cConjecture(x,lista = [], i = 0):
if x%2 == 0:
x = x/2
else:
x = 3*x+1
i+=1
lista.append(x)
if lista[len(lista)-1:len(lista)-4:-1] == [1,2,4]:
result = []
result.append(lista)
result.append(i)
return result
else:
return cConjecture(x,lista, i)
x = int(input('Insert number: '))
dict = cConjecture(x)
print(dict)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run