<s>[INST] Number of Ways of Writing $n$ as Sum I have a general question about numbers:

How many ways can we write $n$ as the sum of the numbers $1$,$2$ and $3$?

I know that we start with the following functions: $$\frac{1}{1-z} = 1+z+z^2+ \dots$$ $$\frac{1}{1-z^2} = 1+z^2+ z^4+ z^6 + \dots$$ $$\frac{1}{1-z^3} = 1+ z^3+ z^{6}+ z^{9} + \dots$$ 
Multiplying these together we get $$\sum C(n) z^n = \frac{1}{(1-z)(1-z^2)(1-z^3)}$$ where $C(n)$ is our answer. In other words, by multiplying out the polynomials and looking at the coefficients, I can verify that I get the answer. But how do I know that this gives me the answer? How would I get an explicit formula for $C(n)$? I think I have to do something with partial fractions. So $$\frac{1}{(1-z)(1-z^2)(1-z^3)} = \frac{A}{1-z} + \frac{B}{1-z^2}+ \frac{C}{1-z^3}$$ and we have to solve for $A$, $B$ and $C$? 
 [/INST] Denote by $N_3=\{1,2,3\}\,$ then your question can be reformulated:
Find the number of partitions of natural number n in parts over set $N_3$ that number we denote
$p(n,N_3)$, $n=6k+l$, where $ k\in \{0,1,2,...\}$,and $ l\in \{0,1,2,3,4,5\}\,$
Using recurrences (no generating functions) I find that exact solution is. 
[1]  $p(6k,N_3)=3k^2+3k+1$
[2] $p(6k+1,N_3)=3k^2+4k+1$
[3] $p(6k+2,N_3)=3k^2+5k+2$
[4] $p(6k+3,N_3)=3k^2+6k+3$
[5] $p(6k+4,N_3)=3k^2+7k+4$
[6] $p(6k+5,N_3)=3k^2+8k+5$
To explain each formula is needed a lot of introduction
example: $p(10,N_3)=14$ because
[1,1,1,1,1,1,1,1,1,1]
[1,1,1,1,1,1,1,1,2]
[1,1,1,1,1,1,1,3]
[1,1,1,1,1,1,2,2]
[1,1,1,1,1,2,3]
[1,1,1,1,2,2,2]
[1,1,2,2,2,2]
[1,1,1,1,3,3]
[1,1,1,2,2,3]
[1,1,2,2,2,2]
[1,2,2,2,3]
[2,2,2,2,2]
[1,3,3,3]
[2,2,3,3]
From our formulas we have
$p(10,N_3)=p(6\times 1+4)=3\times 1^2+7\times 1+4=14$ there $k=1$ 
</s>