One good method is the Miller-Rabin test. It should be noted however, that this is only a probabilistic test.
More Related Contents:
- Which is the fastest algorithm to find prime numbers?
- Creating all possible k combinations of n items in C++
- Finding all the subsets of a set
- Fast ceiling of an integer division in C / C++
- Determining if a number is prime
- Printing prime numbers from 1 through 100
- Most efficient/elegant way to clip a number?
- Special simple random number generator
- sine wave that slowly ramps up frequency from f1 to f2 for a given time
- Efficiently getting all divisors of a given number
- Inverting a 4×4 matrix
- Fastest way to get the integer part of sqrt(n)?
- Finding square root without using sqrt function?
- Mixing two arrays by alternating elements two by two
- banker’s algorithm in c++
- All Possible Combinations of a list of Values
- Sorting zipped (locked) containers in C++ using boost or the STL
- Can’t make value propagate through carry
- How does photoshop blend two images together? [closed]
- Direct way of computing clockwise angle between 2 vectors
- Algorithm to find which numbers from a list of size n sum to another number
- C++ string::find complexity
- Math to convert seconds since 1970 into date and vice versa
- Does casting to an int after std::floor guarantee the right result?
- Random number generator that produces a power-law distribution?
- Finding nearest point in an efficient way
- Convert string to mathematical evaluation [closed]
- std::back_inserter for a std::set?
- Optimizations for pow() with const non-integer exponent?
- C#: How to make Sieve of Atkin incremental