Beatty sequence says that every irrational number can generate two sequences of acending numbers where every positive integer belongs to exactly one of these sequences. $$\mathcal{B}_r = \left( \lfloor{nr}\rfloor\right) \qquad n \geq 1\\ \mathcal{B}_s = \left( \lfloor{nt}\rfloor\right) \qquad n \geq 1\\ \mathcal{B}_r \cap \mathcal{B}_s = \varnothing\\ \mathcal{B}_r \cup \mathcal{B}_s = \mathbb{N}\\ Where\qquad s = \dfrac {r}{r - 1}$$
Therefore for every natural number $N$ and irrational number $r$ we can generate two sets of integers that contain all nubers $\{i \in \mathbb{N}: 1 \leq i \leq N\}$: $$\mathcal{B}_r = \left( \lfloor{nr}\rfloor\right) \qquad 1 \leq n \leq m\\ \mathcal{B}_s = \left( \lfloor{ns}\rfloor\right) \qquad 1 \leq n \leq j\\ \mathcal{B}_r \cup \mathcal{B}_s = \left(n\right)\qquad 1 \leq n \leq N$$
For example: $$ N = 10, \qquad r = \sqrt{2} \quad\Rightarrow\quad s = 2 + \sqrt{2}\\ \mathcal{B}_r = \left(1, 2, 4, 5, 7, 8, 9\right) \qquad m = 7\\ \mathcal{B}_s = \left(3,6,10\right) \qquad\qquad\quad j = 3$$
Now what I want to do is calculate the values of $m$ and $j$ for each given natural number $N$
$$\lfloor{mr}\rfloor \le N\\ \lfloor{mr}\rfloor \lt N + 1\\ mr \lt N + 1\\ m \lt \frac{N+1}{r}\\ m = \lfloor{\frac{N+1}{r}}\rfloor\qquad(1)$$
Similaryly we find that:
$$j = \lfloor{\frac{N+1}{s}}\rfloor\qquad(2)$$
However when I try to implement $(1)$ and $(2)$ to compute $m$ and $j$ values I don't get the expected values when $N$ gets large. I'm not sure if the problem is with my coputer program or the above equations, Are $(1)$ and $(2)$ correct for $\{N \in \mathbb{N}: 1 \le N \le 10^{100}\}$?
Error example:
>>> N
2102607186491202768324985186154486949972248746737044231178178291724599849547926451438364791930880L
>>> n
1486767799739497169195432937353753354226423926286278051482159206775440977387852125373193825288192L
>>> j
615839386751705599129552248800733595745824820450766179696019084949158872160074326065170966642688L
>>> n == ((N + 1) / sqrt(2))
True
>>> j == ((N + 1) / (2 + sqrt(2)))
True
>>> floor ((sqrt (2)) * n) <= N
True
>>> floor ((2 + sqrt (2)) * j) <= N
False
>>>