Coding challenge

Write some code that starts with some integer $n$. If $n$ is even, divide it by $2$. If it's odd, multiply it by $3$ and add $1$. Repeat this on your result over and over again, and stop when the result becomes $1$. Does this sequence always lead to $1$ for any starting value of $n$?

Type your code here:


Lua reference

See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code: