Link to the original problem
It\'s not a homework question. I just thought that someone might know a real solution to this problem.
I was on
I'd attack the second problem, to compute N! mod (N+1), using Wilson's theorem. That reduces the problem to testing whether N is prime.