@Manoaj1809:
Optimise the function, think about when the loop will end.
Read about the Sieve of Erastothenes. Do you think it would be useful to implement that here?
There are many advanced primality tests, you may find them interesting. Perhaps for liquid all we need is a clever balance between stored primes (in some map?) and an algorithm which can determine primality beyond the map.
What do you think?
@Manoaj1809:
Optimise the function, think about when the loop will end.
Read about the Sieve of Erastothenes. Do you think it would be useful to implement that here?
There are many advanced primality tests, you may find them interesting. Perhaps for
liquidall we need is a clever balance between stored primes (in some map?) and an algorithm which can determine primality beyond the map.What do you think?