desolatora

desolatora / isPrime / 0.1.0

README.md

Using the fact that all primes are in the form c#k+i, where c# is the c-th primordial and i represents the numbers that are coprime to c# the algorithm implements primality testing using Trial Division using divisors only in the form 210k+i, which makes it several times faster.

Works for all numbers smaller than 9223372036854775807 (long max value). 

Sample input with 2147483647 also known as the 8-th mersenne prime.