Top self-intersection of exceptional divisors Let $Y\subset\mathbb{P}^n$ be a smooth variety of codimension two. Consider the blow-up $X = Bl_Y\mathbb{P}^n$ of $\mathbb{P}^n$ along $Y$, and let $E$ be the exceptional divisor over $Y$. Then $E$ has a structure of $\mathbb{P}^1$-bundle over $Y$. The anticanonical divisor is 
$$-K_X = (n+1)H-E.$$
I would like to compute $(-K_X)^n$. For example if $Y\subset\mathbb{P}^3$ is a curve of degree $d$ and genus $g$, by Shafarevich "Algebraic Geometry V" Lemma 2.2.14, we have:
$$E^3 = -deg(N_{Y/\mathbb{P}^3}) = K_{\mathbb{P}^3}\cdot C-2g+2 =-4d-2g+2.$$
and
$$(-K_X)^3 = 62+2g-8d.$$
I would like to have a formula for the top self-intersection $(-K_X)^n$ when $X$ is the blow-up of a smooth subvariety $Y\subset\mathbb{P}^n$ of codimension two. Even for complete intersections of two hypersurfaces it would be good. More generally does there exists a formula for $(-K_X)^n$ when $X$ is the blow-up of $\mathbb{P}^n$ along a smooth subvariety of codimension $c$ (again, I would be happy with complete intersections)?
 A: So you want to compute the intersection numbers $(H^p\cdot E^q)$, $p+q=n$.
Let me start with some notation. Let $b: X\rightarrow \mathbb{P}^n$ be the blowing up, $i:E \hookrightarrow  X$ the embedding, $p:E\rightarrow Y$ the projection. Write one factor $E$ as $i_*1$ (in $CH(X)$, say) and use the projection formula twice:
$$(H^p\cdot E^q)=(i^*E^{q-1}\cdot p^*H_Y^p)=(p_*i^*E^{q-1}\cdot H_Y^p)\quad \mbox{where }\ H_Y:=c_1(\mathcal{O}_{\mathbb{P}^n}(1))_{|Y}\ .$$ We have $i^*E=-h$, where $h$ is the first Chern class of the tautological line bundle $\mathcal{O}_E(1)$ on $E=\mathbb{P}(N^*_{Y/\mathbb{P}^n})$. The classes $s_m:=p_*h^{m+c-1}$ (with $c=\mathrm{codim}(Y)$) are the Segre classes of  $N_{Y/\mathbb{P}^n}$; they are easily calculated from the Chern classes, see Fulton Intersection Theory, Chapter 3. So the numbers $(H^p\cdot E^q)=(-1)^{q-1}s_{q-c}\cdot H_Y^p$ can be calculated when you know the Chern classes of the normal bundle. In codimension 2 you just have two nonzero Chern classes, so the computation is relatively easy. For instance, if $n=3$ and $Y$ is a curve of degree $d$ and genus $g$, you find $(-K_X^3)= 64-8d+2g-2$. 
