Primality proof for n = 323131:
Take b = 2.
b^(n-1) mod n = 1.
10771 is prime. b^((n-1)/10771)-1 mod n = 300641, which is a unit, inverse 34497.
(10771) divides n-1.
(10771)^2 > n.
n is prime by Pocklington's theorem.