We have now modulo by our side! Let’s deal with big guys, shall we?

Dr. Strange vs. Thanos (Avengers: Infinity War)

Dr. Strange vs. Thanos (Avengers: Infinity War)

Without the modulo operation, we don’t have a feasible option in C++.

Using strings to represent unbounded integers and implementing arithmetic operations on strings is always an option, but this would be computationally expensive as numbers get enormous.

So, we just use remainders!

Let’s see how to calculate the elementary stuff regarding counting modulo $m = 10^9 + 7$.

You can always calculate stuff or verify your results at WolframAlpha!

Factorials

Binomial Coefficients

This finalizes our math journey. However, there are some quite useful tips and tricks left. Let’s see!