Primality proof for n = 29581:
Take b = 2.
b^(n-1) mod n = 1.
29 is prime.
b^((n-1)/29)-1 mod n = 12013, which is a unit, inverse 4750.
3 is prime.
b^((n-1)/3)-1 mod n = 1982, which is a unit, inverse 19059.
2 is prime.
b^((n-1)/2)-1 mod n = 29579, which is a unit, inverse 14790.
(2^2 * 3 * 29) divides n-1.
(2^2 * 3 * 29)^2 > n.
n is prime by Pocklington's theorem.