First, please pardon my entry-level knowledge. This algorithm determines if a # is prime. I'm mainly confused on the parts involving the square root & the mod operator.

Code:public static String isPrime(long numToCheck) { for (long i=2;i<=Math.sqrt(numToCheck);i++) { if (numToCheck%i==0) { return "Not prime"; } } return "Is indeed prime"; }

Tweet This+ 1 thisPost To Linkedin