I am currently doing a sequence "Ulam sequence" in particular, but i cannot manage to identify odd and even numbers using while, do-while loops. I need this odd and even numbers identification. N is a variable that I inserted and is going to accept integers. These integers must be identified as odd or even, so it can proceed to 1 or end to 1.
If N is 1, stop.
If N is even, replace it with N/2.
If N is odd, replace it with 3*N+1.
Continue this process until N reaches 1.