# Mathematica, 33 bytes Print[Mod[(#-1)!^2,#]>0&@Input[]] or Print[Length@Divisors@Input[]==2] Mathematica has a built-in `PrimeQ` as well, but I believe it uses a probabilistic test.