What is the problem in this segmented sieve code