fixed prime generating function