Solved Prime1 in SPOJ.Learnt Segmented Seiv