Primality proof for n = 40024942543673:
Take b = 2.
b^(n-1) mod n = 1.
25396537147 is prime.
b^((n-1)/25396537147)-1 mod n = 24760559515411, which is a unit, inverse 36222238642773.
(25396537147) divides n-1.
(25396537147)^2 > n.
n is prime by Pocklington's theorem.