Take b = 2.

b^(n-1) mod n = 1.

787 is prime.

b^((n-1)/787)-1 mod n = 2217019, which is a unit, inverse 5084108.

307 is prime.

b^((n-1)/307)-1 mod n = 788803, which is a unit, inverse 1415132.

(307 * 787) divides n-1.

(307 * 787)^2 > n.

n is prime by Pocklington's theorem.