How the test works
Trial division only needs to check divisors up to √n; skipping multiples of 2 and 3 (the 6k±1 wheel) removes two thirds of the work.
Frequently asked questions
Limit?
~1e15 before trial division gets slow.
Negative/zero?
0 and 1 are not prime.
Crypto grade?
For big integers use a proper library.