I think < should be <=, otherwise e.g. 9 seems to be prime