How can I check if "value is fractional multiple of another" in "modulo sense"?

24 Views Asked by At

How can I check if "value is fractional multiple of another" in "modulo sense"?

Typically in programming the modulo is used like:

if n mod m == 0

which means that $n$ is an integer multiple of $m$.

However, what if I want to check whether $n$ is a $1/10th$ of $m$ in the "recurring" modulo sense? That is, e.g.

$m=20$, consider

$n=2$, should return true since $2/20=1/10$

$n=22$, should return true.

$n=42$, should return true.

...

(the pattern you see in $n$ is "recurring", because even when $n$ is a different number it's evaluated in the same way as the base case.


Could it be as simple as taking $n \mod m = r$, then checking if $r / m = \text{desired fractional}$?