n과 소수 p가 매우 클 때 wilson's theorem와 fermat's little theorem을 이용한 n! mod p 구하기

https://en.wikipedia.org/wiki/Wilson%27s_theorem Wilson's theorem - Wikipedia From Wikipedia, the free encyclopedia Theorem on prime numbers In algebra and number theory, Wilson's theorem states that a natural number n > 1 is a prime number if and only if the product of all the positive integers less than n is one less than a multip en.wikipedia.org https://namu.wiki/w/%EC%9C%8C%EC%8A%A8%EC%9D%9..