How do i repeat a function n times until it reaches a certain parameter?

Let’s say i use a function with variable a that goes as follows:

{mod(a,2) = 1:3a+1, a/2}

How do i get its answer and put it through the same function until it reaches 1?

You can use actions and a ticker to do this repeatedly: collatz | Desmos