An algorithm that describe how to find a cycle length for an integer .
Considere el siguiente algoritmo:
-
input n
-
print n
-
if n = 1 then STOP
4. if n is odd then n = 3n + 1 5. else n = n / 2
-
GOTO 2
//INPUT 22
//OUTPUT 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
there's a program that Describe how to find the maximum cycle length between two integers included them .
Example
//input 1 10
//output 20