Finding prime factors by taking the square root

Solution 1:

If a number $N$ has a prime factor larger than $\sqrt{N}$ , then it surely has a prime factor smaller than $\sqrt{N}$.

So it's sufficient to search for prime factors in the range $[1,\sqrt{N}]$, and then use them in order to compute the prime factors in the range $[\sqrt{N},N]$.

If no prime factors exist in the range $[1,\sqrt{N}]$, then $N$ itself is prime and there is no need to continue searching beyond that range.

Solution 2:

If you do not find a factor less than $\sqrt{x}$, then $x$ is prime for the following reason. Consider the opposite, you find two factors larger than $\sqrt{x}$, say $a$ and $b$. But then $a\cdot b> \sqrt{x}\sqrt{x} = x$. Therefore, if there is a factor larger than $\sqrt{x}$, there must also exist a factor smaller than $\sqrt{x}$, otherwise their product would exceed the value of $x$.

Regarding the last question. You will not miss some factor like $2\cdot n$ because you have already checked if $2$ is a factor.