Fast modular exponentiation with factorial

96 Views Asked by At

I have a task 50!+7^133 mod 5.

I know that 7^133(mod5)=2(mod5) because:

7=2(mod5)

7^2=4(mod5)

7^3=3(mod5)

7^4=1(mod5)

7^133= 7^(433+1)=(7^4)^337^1=1*2=2(mod5)

I'm not quite sure how can I calculate 50 in factorial. Any tips?

1

There are 1 best solutions below

4
On BEST ANSWER

If $a \le b$ then $b! \equiv 0 \bmod a$.

In this problem, $50! \equiv 0 \bmod 5$.