POWPOW2 solution

Can anyone explain to me what is happening in 67-83 lines

Hey @apaarkamal can you help me with this? Thanks :smile:

1 Like

see actually 1000000006=2 * 5000000003 therefore they are calculating (n factorial % 2) and (n factorial % 500000003) and so on for all the primes . because these factorials will come in use from line 93 to 100.

Thanks bro, but why they are calculating it up to 200007?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.