i am not understand 4th approach of optimization please explain
Prime sieve optimization
hello @vishal_sangal_123
its property that if number is n then atleast one of its prime factors lie sqrt(n).
so if i*i is the number then one of prime factor will lie in range i.
so that is the reason if we are at i then we are starting from ii onwards.
becuase all elements that are less than ii are already marked by prime factor less than i