# Proving the Castelnuovo bound is achieved for a curve in $\mathbb{P}^n$

I am solving problems from Rick Miranda's book "Algebraic Curves and Riemann Surfaces". Problem I from section VII.3 asks to verify that the Castelnuovo bound for the genus $g$ of a (smoothly embedded, nondegenerate) curve $X$ in $\mathbb{P}^n$, of degree $d$, is achieved for any choice of $d\geq n\geq 2$.

I know how to solve the problem using algebraic surface theory (for instance as outlined in section III.2 of Arbarello, Cornalba, Griffiths, Harris - Geometry pf Algebraic Curves, Volume I), but I am not sure how it can be tackled using just the machinery introduced by Miranda up to that point (i.e. "elementary" theory of curves, linear systems, Riemann-Roch etc).

Any suggestions?