Skip to main content
2 of 4
added 158 characters in body
lynn
  • 69.2k
  • 11
  • 133
  • 283

C, 63 bytes

i,n;main(p){for(scanf("%d",&i),n=i;--i;p*=i*i);putchar(48+p%n);}

Prints !1 (a falsey value, by Peter Taylor's definition) 0 if (n-1)!^2 == 0 (mod n), and 1 otherwise.

EDIT: After some discussion in chat, puts("!1"+p%n) seems to be considered a bit cheaty, so I've replaced it. The result is one byte longer.

lynn
  • 69.2k
  • 11
  • 133
  • 283