Refactored GeneratePrimesRange() method