Primality proof for n = 1777:
Take b = 3.
b^(n-1) mod n = 1.
37 is prime.
b^((n-1)/37)-1 mod n = 1744, which is a unit, inverse 700.
3 is prime.
b^((n-1)/3)-1 mod n = 1146, which is a unit, inverse 1394.
(3 * 37) divides n-1.
(3 * 37)^2 > n.
n is prime by Pocklington's theorem.