is this a property of inverse modulo operation?

if i have to find : a / ( b * c * d ) (mod m)

it is supposed to be like: a * (b^-1) * (c^-1) * (d^-1), where x^-1 is modular inverse with (mod m)

can we say that it is equal to: a * ((( b * c * d )%m)^-1) ?

NOTE: assume mod and numbers b, c, d are co-primes.

1 Like

No Its not supposed to be done in this manner.If you have to calculate a / ( b * c * d ) (mod m)
then it is calculated by fermets principal.

a / ( b * c * d ) (mod m)=(a * (b^m-2) * (c^m-2) * (d^m-2))%m

Note: m should be prime

1 Like

What happens if m is nonprime?

As you noted m needs to be relatively prime to bcd, so if b,c, or d have a factor of m this will not work. Also note that if m is not prime, but is relatively prime to b,c and d then we replace m-2 with phi(m) - 1, where phi is the euler totient function, to find the inverse. i.e for m relatively prime to x we have that x^{-1} (mod m) = x^{phi(m) - 1}

In general it is somewhat slow to compute a^(phi(m) - 1) for large m, so you will want to look up euclid’s extended algorithm to find the modular inverse.

I don’t think this answers you question though. If I am correct then you are asking is equivalent to whether x / y (mod m) = (x / (y m)) m? I think this still works as long as y, m are relatively prime.

no. 4 / 2 (mod 2) != (4 / (2 2)) 2.

the only rule is a^(phi(n)-1) if gcd(a,n)==1 (euler).

if n is a prime, it’s a specific case. if n is prime, phi(n) = n-1, so a^(n-2) = a^(-1) % n.

if gcd(a,n)!=1, ‘a’ has simply no inverse (you can try to find 6^-1 % 10, it does not exist).

i read and found that fermat’s little theorem is not applicable if number is divisible by mod. Even though the mod is prime, this will not be applicable when number is equal to prime mod. What can we do in that case?