Algorithm to find an approximation for a common factor of a set

22 Views Asked by At

Given a set of positive real numbers $X=\{x_1,...,x_n \}$ and let $\varepsilon>0$, how could one find the smallest $z>0$ such that $$\mid(z\cdot x_i)-f(z\cdot x_i) \mid<\varepsilon $$ for $i \leq n $, where $f(x)$ is the closest natural to $x$, and if two naturals are at the same distance of $x$, $f$ maps it to the even integer.

Thanks in advance

Also, by natural I mean a positive (non-zero integer), i.e. $f(0.002)=f(-32)=1$.

1

There are 1 best solutions below

0
On

Not an answer:

The condition may be unsatisfiable for most $\varepsilon < 1/2$. As a random example, set $$ X = \{8.44045, 7.62664, 3.16536, 8.96804, \\ 5.16923, 1.63361, 8.11436, 4.27568, \\ 3.11587, 1.10181\} \text{.} $$

Then simultaneously plotting $|z x_i - f(z x_i)|$ as $z$ ranges over $(0,1]$ yields

Simltaneous plot

While there may be a surprise coincidence allowing a solution in $z$ for a small value of $\varepsilon$, expect these to be rare.