# Modular Division For non co-prime numbers

How can I calculate $(x*k)/i$ (mod $m$) where i and m are relatively not co-prime ?

We know that, if $\gcd(i,m)\neq1$ , then there doesn't exist a modular multiplicative inverse of $i$ mod $m$. Then how can it be solved?

However, if $(x*k)/\gcd(i,m)$ is an integer, you could calculate it using: $$(x*k)/i \equiv (x*k)\Big/\left(\gcd(i,m)*\frac{i}{\gcd(i,m)}\right)\pmod m \\\equiv (x*k/\gcd(i,m))*\left(\frac{i}{\gcd(i,m)}\right)^{-1} \pmod m$$
Note that $\frac{i}{gcd(i,m)}$ and $m$ are co-prime.