Question: In the following snippet from <https://github.com/nayuki/Project-Euler-solutions/blob/master/p003.java> :

```
private static long smallestFactor(long n) {    
  for (long i = 2, end = Library.sqrt(n); i <= end; i++) {    
    if (n % i == 0)    
      return i;   
  }    
  return n; // Prime    
}

```

I was a bit confused with the `return n` part. Is `n` going to assume the value of `i` after it's returned in the if statement? Why?

Answer: 
No. It returns the unchanged parameter to indicate that it is prime.

If it is not prime, it returns the factor that shows it is not prime.
lets take a num.

num is divisible upto its half (i.e factors)

Implement [Sieve of Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) for finding prime\_numbers. It's an efficient process for finding Prime numbers. And then check whether the returned primes divide the "num" or not...