I have posted this question originally in Stack Overflow.
The question is, "Is there a mathematical approach in getting the reverse of the Modulo Operator with given result $r$ and divisor $d$?"
So, the Modulo Operator % gives the remainder when dividing two numbers:
3 % 2 = 1
I will be asking the same question here.
Is there a mathematical approach in getting the reverse of the Modulo Operator with given result $r$ and divisor $d$?
NOTES:As I have stressed in the SO question, the answers should be limited to numbers which can be converted to a valid time in the format HHMMss.xxx where HH is the 24-hour respresention of hours, M is the minutes, s as seconds and x as millisecond. You need not worry about that part though because I can do a checking using Regex for that. You can check my updated question in SO.
1 Answer
$\begingroup$As pointed out in the comments and in the original Stack Overflow post, there are infinitely many numbers which divided by $\mathbf{d}$ have remainder $\mathbf{r}$. So there is a reverse operator given $d$ and $r$, but it will give you infinitely many solutions of the form $d\cdot k +r$.
$\endgroup$ 4