If I have a value:
A mod P, where P is a prime number, and A=a*b*c*d.... n elements.
Is there a way to transform this product modulo some other number which is co-prime to P.
Like A mod M.
Or will I have to do all multiplications over again?
what if there are multiple such queries?
if I have to find A mod M multiple times for many values of M. What will be the best method to do that? Also A becomes very large to handle. Of the range 10^100000. So the only method remains is doing all the multiplications over again? Or can we do better?