+ 4
def Collatz(x)
if x%2 == 0
return(x/2)
else
return(x*3+1)
end
end
num = n = gets.chomp.to_i
folk = []
folk.push(n)
until n == 1 do
n = Collatz(n)
folk.push(n)
end
print folk
# Good Luck
https://code.sololearn.com/c3TE5SH5Mq2k
https://en.wikipedia.org/wiki/Collatz_conjecture