I have a list of numbers that all supposed to be near $X$ times of a basic "module" value. For example, $3.1$, $2.9$, $6.2$, $6.1$ are four values with a "module" value around $3$. I also know $X$ is limited to either $1$ or $2$, or $3$. For example, $1.5$ could be a "module" value for the above $4$ numbers but that would result in $X$ being $4$ for both $6.2$ and $6.1$, thus the correct answer would be $3$ (the exact value should be somewhere around $3$, for example, maybe $3.1$, or $3.05$, since I do not know how to calculate it) instead of $1.5$.
So given a list of numbers, the minimum and the maximum value of an integer multiply factor, how to find the closest matching "module" value?