Find the modulo of large number

81 Views Asked by At

I need to find the value of y%mod where mod is a prime number and y is defined below

$y = a_1\cdot a_2 \cdot a_3 \cdot a_4\cdots a_n$

I know the value of $t = \log a_1 +\log a_2+\cdots+\log a_n$.

How to find the exact value of y%mod since y can be very large so i can't simple used $(Math.E^t)$ ?

1

There are 1 best solutions below

0
On

Hint: $y \equiv k_1 \cdot k_2\cdots k_n \mod{p}$, where $a_i \equiv k_i \mod{p}$.