Number of natural numbers made from the digits 1, 2 and 3 wherein the sum of their digits is equal to n. The problem is to count the number of different natural numbers that can be made from three digits 1, 2 and 3 in which the sum of the digits is equal to n.
 A: Let $a_n$ be the number of such numbers with digit sum $n$. Any number made up of the allowed digits ends with $1$, $2$, or $3$. There are $a_{n-1}$ numbers with digit sum $n$ that end in $1$, $a_{n-2}$ that end in $2$, and $a_{n-3}$ that end in $3$. This gives the recurrence
$$a_n=a_{n-1}+a_{n-2}+a_{n-3}.$$
Using this recurrence, and the initial conditions $a_1=1$, $a_2=2$, and $a_3=4$, we can readily compute $a_n$ for reasonably small $n$.
A closed form can in principle be obtained by noting that our recurrence has characteristic polynomial $x^3-x^2-x-1$. We could find the roots $\alpha$, $\beta$, and $\gamma$ of this. They are not pleasant, but can be found explicitly from the Cardano Formula for the roots of the cubic.
Then $a_n=A\alpha^n+B\beta^n+C\gamma^n$ for constants $A,B,C$ determined by the initial conditions.
It so happens that, (apart from where the indexing starts), our sequence is the Tribonacci Sequence. There is some discussion of the closed form in the linked Wikipedia article. Searching under tribonacci sequence will give many more hits.
