parallelize prime sieving and guard against stack smash