Error in nextprime() corrected.