Ok, I'm not that interested in coding this out, so I'll run you through what is going on with your code.

Lets call isPrime(5). This should return 3 (unless you consider 1 a prime number, which...