Primality proof for n = 2351:
Take b = 3.
b^(n-1) mod n = 1.
47 is prime.
b^((n-1)/47)-1 mod n = 627, which is a unit, inverse 15.
5 is prime.
b^((n-1)/5)-1 mod n = 1770, which is a unit, inverse 2177.
(5^2 * 47) divides n-1.
(5^2 * 47)^2 > n.
n is prime by Pocklington's theorem.