Uptade PrimeNumber Function

For loop's end point should be square of the number that controlling that is prime.