Primality proof for n = 315461:
Take b = 2.
b^(n-1) mod n = 1.
15773 is prime. b^((n-1)/15773)-1 mod n = 102192, which is a unit, inverse 141416.
(15773) divides n-1.
(15773)^2 > n.
n is prime by Pocklington's theorem.