Yeah, i will definitely remember that.

Thanks a ton for your help though.

# Sum All Primes(help)

Sum All Primes(help)

0

**mjennings78717**#22

I see some of the isPrime functions use the square root of the number being tested. I use roughly 1/2 of the evaluated number because all numbers greater than 1/2 of an evaluated number will cause a remainder.

If the built in Math library functions are available, I can see the efficiency gained from fewer loops of using a number’s square root instead of half of a number. Can somebody explain the accuracy of using square root?

Below is my version of the isPrime function.

```
function isPrime(num){
for (let i = 2; i < (num+1)/2; i++){
if(num%i==0){
return false;
}
}
return true;
}
```

0 Likes