bool checkSix(const int num) { unsigned int i, half; if (num <= 1) return 0; if (num == 2 || num == 3) return 1; else if (num % 6 != 1 && num % 6 != 5) return 0; half = (unsigned int)sqrt(num); for (i = 5; i <= half; i += 6) { if (num % i == 0 || num % (i + 2) == 0) return 0; } return 1; }
|