Primality proof for n = 2591:
Take b = 2.
b^(n-1) mod n = 1.
37 is prime.
b^((n-1)/37)-1 mod n = 233, which is a unit, inverse 2313.
7 is prime.
b^((n-1)/7)-1 mod n = 2379, which is a unit, inverse 2481.
(7 * 37) divides n-1.
(7 * 37)^2 > n.
n is prime by Pocklington's theorem.