close all; clear; clc

x = input("Enter a number: ");

while x ~= 1
    if mod(x, 2) == 0
        x = x / 2;
    else
        x = 3 * x + 1;
    end
    fprintf("%d\n", x)
end