|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Primality test implementation. More...
#include <iostream>Functions | |
| bool | IsPrime (int number) |
| int | main () |
Primality test implementation.
A simple and efficient implementation of a function to test if a number is prime, based on the fact that
Every Prime number, except 2 and 3, are of the form \(6k\pm1\) for integer values of k.
This gives a 3x speed improvement.
| bool IsPrime | ( | int | number | ) |
Check if a number is prime
| [in] | number | number to check |
| int main | ( | void | ) |
main function