Primality proof for n = 365357:
Take b = 2.
b^(n-1) mod n = 1.
379 is prime.
b^((n-1)/379)-1 mod n = 207697, which is a unit, inverse 310280.
241 is prime.
b^((n-1)/241)-1 mod n = 212435, which is a unit, inverse 112886.
(241 * 379) divides n-1.
(241 * 379)^2 > n.
n is prime by Pocklington's theorem.