Method to find solutions for $\{nz\}\in (x,x+\epsilon)$ for an irrational value $z$. (approximation with the fractional part) Suppose that we are given an irrational number $z$, a value $x\in[0,1)$ and soe $\epsilon> 0$. We want to find an integer $n$ such that $\{nz\}\in (x,x+\epsilon)$ . (Note that by $\{\alpha\}$ I mean the fractional part of $\alpha$ in this context).
Such an $n$ clearly must exist as $\{nz\}$ is dense in $[0,1]$. But I have not been able to find a good method to come up with an $n$. I thought about putting $z$ as a periodic fraction but I am not sure how to proceed.
Some code in c or a similar language would be greatly appreciated.

For a treatment without continued fractions, see Diophantine Approximations by Niven. 
Well, I did an example with $x + \frac{\epsilon}{2}= 1/2$ and $z=\pi.$ I wanted to get 
$$ n \pi - m - \frac{1}{2} = n \pi - \frac{2m+1}{2} $$ small, or
$$    \pi - \frac{2m+1}{2n} $$ very small.
The first convergent to $\pi$ with odd numerator and even denominator was 
$333/106,$ and we do get
$$ 53 \pi \approx 166.50441 $$
which is pretty good.
Needs work
