CHEFPRMS and LEVY help needed

c-plus-plus
easy
prime
sieve
simple

#1

can anyone help me with CHEFPRMS and LEVY problem . I can’t understand where am I going wrong .
also , I would be thankful if anyone would explain me why i*i<n is taken instead of i<n when iterating for finding all primes .
CHEFPRMS solution

LEVY solution