Inequality with modulo For $n\in \mathbb{N}$, $\theta\in (-\pi/2,\pi/2)$, $\varepsilon\in \mathbb{R}^+$, $\varepsilon\ll 1$, I am trying to compute given $\theta$ and $\varepsilon$ the first rank $n(\theta,\varepsilon)>0$ of the sequence $(\gamma_n)$ satisfying the inequality $\gamma(n,\theta) \le \varepsilon$ where $$ \gamma_n = n (\pi-2\theta) \pmod{2\pi} $$

First, $\gamma_n\ge0$ and there is a unique integer $p$ such that $n (\pi-2\theta)-2\pi p\in [0,2\pi)$; it is given by
$$
p(n,\theta) =  \left \lfloor n\frac{\pi-2\theta}{2\pi} \right\rfloor.
$$
EDIT:
$(\gamma_n)$ is bounded, there exists an adherence value of $(\gamma_n)$.
More precisely, define $\varphi(n) =\frac{2\pi}{\pi-2\theta}n$ then the subsequence $\gamma_{\varphi(n)}$ is converging to $0$, that is $0$ is an adherence value of $(\gamma_n)$.
This proves the existence of the rank $n(\theta,\varepsilon)$ 
$\varphi(n)$ does not take integer values...
($\varepsilon\ll 1$), but now how to compute such rank ? 
 A: I managed to get a rather theoretical definition, not sure it would be much use for practical purposes, but here it goes: 
I first reformulate your problem in another set of variables. Let $\phi = \pi - 2\theta$, so that $\phi \in (0, 2\pi)$. Then let $r = 2\pi/\phi$, so that $r \in (1; +\infty)$. Finally, let $\beta = \varepsilon/2\pi$ (I am thinking of $\beta$ as a fixed parameter; given $\varepsilon$, $n = n(r) = n(2\pi/(\pi-2\theta))$ is just a function of $\theta$).
What you want is the smallest positive integer $n$ such that $n\phi \in [2\pi l, 2\pi l + \varepsilon]$ for some integer $l$. In terms of the above-introduced $r$ and $\beta$, this is the same as
$$ rl \leq n \leq rl + r\beta $$
The smallest $n$ will be obtained by finding the smallest $l$ such that the above holds for some integer $n$ (and then the smallest $n$ is $\left\lceil{rl}\right\rceil$). So we work backwards by finding which values of $r$ work for each $l$ (in increasing order).
For $l= 0$, we must have $0 \leq n \leq r\beta$ and since $n \geq 1$ this implies $r \geq 1/\beta$. In this case $n = 1$.
For any positive $l$, we must have (solve the inequalities for $r$ and temporarily rename $n$ to $k$)
$$ r \in \left[\frac{k}{l+\beta}, \frac{k}{l}\right], \text{for some } k \in \mathbb N $$
and then for those $r$'s we will have $n = \left\lceil{lr}\right\rceil$ as already mentioned. But if a certain value of $r$ was already in one of the intervals that work for a smaller $l$, we need to exclude it. So define:
$$ B_0 = \left[\frac{1}{\beta}, +\infty\right) $$
$$ B_l = (1, +\infty) \cap \left\{\bigcup_{k\in \mathbb N} \left[\frac{k}{l+\beta}, \frac{k}{l}\right] \right\} \setminus \bigcup_{m < l} B_m, $$
for $l > 0$.  
The we can glue together a function $n: (1, +\infty) \rightarrow \mathbb N$ by defining $n(r) = \max(1, \left\lceil{lr}\right\rceil)$, if $r \in B_l$ (the max is to take care of the $l=0$ case). The $B_l$'s are all disjoint by definition, and I think it is not too hard to show that their union is $(1, +\infty)$.
For numerical computations, this might serve. But I can't get anything more explicit than that.
