Redirecting to
NADOS

Wilsons Theorem

you have been given number n and p, you need to find n! % p (n factorial mod p). p is a prime no.
Input Format
The first line contains the integer n and p. 
Output Format
Output an integer in a line containing n! modulo P.
Question Video
Constraints
1<= n <= 10^9
1<= p <= 10^9
1<= abs(n - p) <= 1000
Sample Input
5 11
Sample Output
10


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name