Also answered here by Mathcad
http://web2.0calc.com/questions/past-question-on-wilson-s-theorem
Mathcad's answer.
One last attempt at posting this.The software on this system is hopeless.
We can write 36x27!+25 as (36x31!+(31x30x29x28)x25)/31x30x29x28 and can now factor out 31 from the numerator.So the expression is divisible by 31 and we can write
36x27!+25=31n for some n.
then,to use Wilson,we can write 36x27!+25=31!n/30! and since 31!=30mod 31 ,rearrange to get
n=30!(36x27!+25)/30modulo31 which is divisible by 31.