https://www.codechef.com/problems/HAR001

https://www.codechef.com/problems/HAR001

In this problem, why do we calculate factorial for 10^9 + 6 instead of the normal 10^9+7

1 Like

Read this whole thread.
Look at this for the proof of the special case when p is a prime.

1 Like