Find the number of pairs $(m, n)$ of positive integers such that $\frac{ m}{n+1} < \sqrt{2} < \frac{m+1}{n}$
Find the number of pairs $(m, n)$ of positive integers such that $\frac{ m}{n+1} < \sqrt{2} < \frac{m+1}{n}$ Constraint: $m$ and $n$ are both less than or equal to 1000
I toiled over this problem for a bit. I tested the first few positive integers of m and found the corresponding values of $n$, but no real pattern seemed to emerge. Clearly $m \ge n$ . I believe that for each value of $m$, there were either two or one value(s) for $n$ in no clear order, which is the part that is messing me up. This is meant to be done by hand so I have not used any software on it.
Solution 1:
You can rewrite this as: $$\frac{m}{\sqrt{2}}-1<n<\frac{m+1}{\sqrt{2}}$$
Since $\sqrt{2}$ is irrational, we know that $\frac{m}{\sqrt{2}}-1$ is not an integer, so for an integer $n>\frac{m}{\sqrt{2}}-1$ iff $n\geq \left\lceil \frac{m}{\sqrt{2}}-1\right\rceil =\left\lfloor \frac{m}{\sqrt{2}}\right\rfloor$.
Similarly, $n<\frac{m+1}{\sqrt{2}}$ iff $n\leq \left\lfloor \frac{m+1}{\sqrt{2}}\right\rfloor$. So altogether, we are seeking $m,n$ such that $$\left\lfloor\frac{m}{\sqrt 2}\right\rfloor\leq n\leq \left\lfloor\frac{m+1}{\sqrt{2}}\right\rfloor$$
For a particular $m$, then, the number of possible $n$ is: $\left\lfloor\frac{m+1}{\sqrt{2}}\right\rfloor-\left\lfloor\frac{m}{\sqrt 2}\right\rfloor +1$. Summing over all $m$, the result is $$-1+\sum_{m=1}^{1000}\left(\left\lfloor\frac{m+1}{\sqrt{2}}\right\rfloor-\left\lfloor\frac{m}{\sqrt 2}\right\rfloor +1\right)$$
(The $-1$ is because we don't want to count $n=0$ when $m=1$.)
But this is just $999$ plus a telescoping sum, and we see that the result is:
$$999+\left\lfloor\frac{1001}{\sqrt{2}}\right\rfloor$$
Actually, even more specifically, it is:
$$1000-\lfloor\sqrt{2}\rfloor + \left\lfloor\frac{1000+1}{\sqrt{2}}\right\rfloor$$
This will work for any irrational number $\alpha>1$ and any upper bound, $M>\alpha$, yielding a total: $$M-\lfloor\alpha\rfloor + \left\lfloor\frac{M+1}{\alpha}\right\rfloor$$
which counts the pairs $(m,n)$ with $1\leq m,n\leq M$ and $$\frac{m}{n+1}<\alpha<\frac{m+1}n$$