# What is the complexity of this algorithm?

I have two algorythimes, I am curious to know what is their complexity. First algorithm verifies modulo of all odd integers of 3,5, …, √n. The second algorithm generates a list of prime numbers from 2.3 …, √n and divides Num by these prime numbers.
In the worst case, it will take √Num / 2 modulo division to do. And a better algorithm will only need division √Num / log⁡n modulo

``````                                bool IsPrime (BigInteger Num)
{
if (Num <2) returns false;
otherwise if (Num <4) returns true;
otherwise if (Num% 2 == 0) returns false;
if not for (BigInteger u = 3; u * u <= Num; u + = 2)
if (Num% u == 0) returns false;
return true;
}
``````

and this one:

``````                                bool IsPrimeBetter (BigInteger Num)
{
ulong arrayLe = (ulong) Isqrt ((long) Num);
if (Num <2) returns false;
otherwise if (Num <4) returns true;
else foreach (var prime in the new Atkin (arrayLe))
if (Num% prime == 0) returns false;
return true;
}
``````

I do not really know how to check their complexity