Processing math: 100%

Problem #114

Revenge with Derangement

Suppose that there are N persons who are numbered 1, 2, ..., N. Let there be N hats, also numbered 1, 2, ..., N. We have to find the number of ways in which no one gets the hat having same number as his/her number.

Let the number of ways to accomplish the above task be D(N) . You need to enter the value of D(N) mod P.

Take N = 49770435560715869 and P = 223092870.

Contributed by Adarsh Kumar

Solved by 39 users

Log in to submit answers.

Is something wrong?

Maintaining a collection of high quality questions is our top priority. If, however, you do find an error, report the problem and we'll make sure it is reviewed soon.