optimize prime numbers generator

step 2 or 4