Finding number of 10 digit numbers A ten-digit number is to be made using the digits from the set $\{0,1,2,3,4\}$ such that the difference between any two consecutive digits is either $1$ or $-1$. How many such numbers can be made?
 A: This method is to count the number of numbers that follow your constraints allowing leading zeroes. You can modify it easily to disallow them, if necessary.

Let $A_n$ be the number of $n$-digit numbers that follow your rules and end with $0$ or $4$.
Let $B_n$ be the number of $n$-digit numbers that follow your rules and end with $1$ or $3$.
Let $C_n$ be the number of $n$-digit numbers that follow your rules and end with $2$. 

Since the only $1$-digit numbers we consider are $0,1,2,3$, and $4$, we have:
$$A_1=2$$
$$B_1=2$$
$$C_1=1$$
Now we can write $A_2$, $B_2$, and $C_2$ in terms of the above values:
$$A_2 = B_1 = 2$$
$$B_2 = A_1+2C_1 = 4$$
$$C_2 = B_1 = 2$$
This agrees with the eight possibilities for two-digit numbers: 
$$01,10,12,21,23,32,34,43$$

More generally, we can write $A_{n+1}$, $B_{n+1}$, and $C_{n+1}$ recursively:
$$A_{n+1} = B_n$$
$$B_{n+1} = A_n+2C_n$$
$$C_{n+1} = B_n$$
This should be enough for you to find the number of $10$-digit strings as
$$A_{10}+B_{10}+C_{10}$$

I wrote a bit of code to find that
$$A_{10} = C_{10} = 162$$
$$B_{10} = 324$$
This is a total of $\boxed{648}$ ten-digit numbers.
