摘要:
这个算法比较全面了,复杂度比较低。没有使用SB的递归,转而使用递减的除数来判定。bool isPrime(int number) { //ignore negative sign number = abs(number); // 0 and 1 are prime numbers if (number == 0 || number == 1) { return true; } //find divisor that divides without a remainder int divisor; for (divisor = num... 阅读全文