Primality proof for n = 3935887:
Take b = 2.
b^(n-1) mod n = 1.
12377 is prime. b^((n-1)/12377)-1 mod n = 3742781, which is a unit, inverse 2804747.
(12377) divides n-1.
(12377)^2 > n.
n is prime by Pocklington's theorem.