The Rank of the Cartier Operator and Linear Systems on Curves