# Find out the length of a recurrence

I have this rules for creating a list of numbers:

1. $x/2$ if $x$ is even, repeat
2. $3x+1$ if $x$ is odd, repeat
3. if $x=1$, stop

so for example, starting from 15, the list will be: 15, 46, 23, 70, 45, 136, 68, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1.

So, for a starting x = 15, the length of the list will be 21. How to find out the length for an arbitrary x?

Of course i'm looking for the most general approach, ie if i change one of the rule or if i add one rule more

-
Look up the "3n+1 conjecture". – coffeemath Dec 20 '12 at 21:16
uao! the rebus daily rebus semms to be more than a simple newspaper rebus.. so, it is an unresolved probleblem and no one know how to calculate it yet? – nkint Dec 20 '12 at 21:26
The simplest way I know of is to simply perform the procedure. There is no known closed form, since it is not known in general whether the list is even finite. – Alex Becker Dec 20 '12 at 21:28
If $x$ is even, $L(x)=L(x/2)+1$. If it's odd and greater than $1$, $L(x)=L(3x+1)+1$. And $L(1)=1$. – mjqxxxx Dec 20 '12 at 23:09