Skip to main content
added 50 characters in body
Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

Mathematica, 2033 bytes

Print@PrimeQ@Input[]Print[Mod[(#-1)!^2,#]>0&@Input[]] 

There'sor

Print[Length@Divisors@Input[]==2] 

Mathematica has a neat short built-in PrimeQ as well, but the I/O functions blow believe it upuses a bitprobabilistic test.

Mathematica, 20 bytes

Print@PrimeQ@Input[] 

There's a neat short built-in, but the I/O functions blow it up a bit.

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.

Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

Mathematica, 20 bytes

Print@PrimeQ@Input[] 

There's a neat short built-in, but the I/O functions blow it up a bit.