Let's consider curve $C\subset \mathbb P^n$ of degree $d$ and genus $g$. We want to calculate dimension of deformation space of $C$, i.e. $h^0(C,L)$ where $L$ is the normal bundle.

We can decompose $L$ as $L_1\subset L_2\dots \subset L$, such as $dim L_{i+1}/L_i =1 \ $ and apply Riemann-Roch to each $L_{i+1}/L_i$.

I heard that this gives us $(n-1)(d-g+1)+2g-2 + 2d\ $ (as expected to be dimension of deformation space of $C$ or the number of points need to fix to count curves degree $d$ and genus $g$ passing through them).

But I can't calculate it ! Could you help me with this or give me a reference ?