Subfield: Number Theory


Question: Let $\lfloor x\rfloor$ denote the greatest integer less than or equal to $x$. For example, $\lfloor 3.1\rfloor=3$ and $\lfloor-1.4\rfloor=-2$.

Suppose that $f(n)=2 n-\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor$ and $g(n)=2 n+\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor$ for each positive integer $n$.
Suppose that $A=\{f(1), f(2), f(3), \ldots\}$ and $B=\{g(1), g(2), g(3), \ldots\}$; that is, $A$ is the range of $f$ and $B$ is the range of $g$. Prove that every positive integer $m$ is an element of exactly one of $A$ or $B$.

Solution:
We want to show that each positive integer $m$ is in the range of $f$ or the range of $g$, but not both.

To do this, we first try to better understand the "complicated" term of each of the functions - that is, the term involving the greatest integer function.

In particular, we start with a positive integer $k \geq 1$ and try to determine the positive integers $n$ that give $\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor=k$.

By definition of the greatest integer function, the equation $\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor=k$ is equivalent to the inequality $k \leq \frac{1+\sqrt{8 n-7}}{2}<k+1$, from which we obtain the following set of equivalent inequalities

$$
\begin{array}{ccccc}
2 k & \leq & 1+\sqrt{8 n-7} & < & 2 k+2 \\
2 k-1 & \leq & \sqrt{8 n-7} & < & 2 k+1 \\
4 k^{2}-4 k+1 & \leq & 8 n-7 & < & 4 k^{2}+4 k+1 \\
4 k^{2}-4 k+8 & \leq & 8 n & < & 4 k^{2}+4 k+8 \\
\frac{1}{2}\left(k^{2}-k\right)+1 & \leq & n & < & \frac{1}{2}\left(k^{2}+k\right)+1
\end{array}
$$

If we define $T_{k}=\frac{1}{2} k(k+1)=\frac{1}{2}\left(k^{2}+k\right)$ to be the $k$ th triangular number for $k \geq 0$, then $T_{k-1}=\frac{1}{2}(k-1)(k)=\frac{1}{2}\left(k^{2}-k\right)$.

Therefore, $\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor=k$ for $T_{k-1}+1 \leq n<T_{k}+1$.

Since $n$ is an integer, then $\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor=k$ is true for $T_{k-1}+1 \leq n \leq T_{k}$.

When $k=1$, this interval is $T_{0}+1 \leq n \leq T_{1}$ (or $1 \leq n \leq 1$ ). When $k=2$, this interval is $T_{1}+1 \leq n \leq T_{2}$ (or $2 \leq n \leq 3$ ). When $k=3$, this interval is $T_{2}+1 \leq n \leq T_{3}$ (or $4 \leq n \leq 6)$. As $k$ ranges over all positive integers, these intervals include every positive integer $n$ and do not overlap.

Therefore, we can determine the range of each of the functions $f$ and $g$ by examining the values $f(n)$ and $g(n)$ when $n$ is in these intervals.

For each non-negative integer $k$, define $\mathcal{R}_{k}$ to be the set of integers greater than $k^{2}$ and less than or equal to $(k+1)^{2}$. Thus, $\mathcal{R}_{k}=\left\{k^{2}+1, k^{2}+2, \ldots, k^{2}+2 k, k^{2}+2 k+1\right\}$.

For example, $\mathcal{R}_{0}=\{1\}, \mathcal{R}_{1}=\{2,3,4\}, \mathcal{R}_{2}=\{5,6,7,8,9\}$, and so on. Every positive integer occurs in exactly one of these sets.

Also, for each non-negative integer $k$ define $\mathcal{S}_{k}=\left\{k^{2}+2, k^{2}+4, \ldots, k^{2}+2 k\right\}$ and define $\mathcal{Q}_{k}=\left\{k^{2}+1, k^{2}+3, \ldots, k^{2}+2 k+1\right\}$. For example, $\mathcal{S}_{0}=\{\}, \mathcal{S}_{1}=\{3\}, \mathcal{S}_{2}=\{6,8\}$, $\mathcal{Q}_{0}=\{1\}, \mathcal{Q}_{1}=\{2,4\}, \mathcal{Q}_{2}=\{5,7,9\}$, and so on. Note that $\mathcal{R}_{k}=\mathcal{Q}_{k} \cup \mathcal{S}_{k}$ so every positive integer occurs in exactly one $\mathcal{Q}_{k}$ or in exactly one $\mathcal{S}_{k}$, and that these sets do not overlap since no two $\mathcal{S}_{k}$ 's overlap and no two $\mathcal{Q}_{k}$ 's overlap and no $\mathcal{Q}_{k}$ overlaps with an $\mathcal{S}_{k}$.

We determine the range of the function $g$ first.

For $T_{k-1}+1 \leq n \leq T_{k}$, we have $\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor=k$ and so

$$
\begin{array}{rlrl}
2 T_{k-1}+2 & \leq & 2 n & \leq 2 T_{k} \\
2 T_{k-1}+2+k & \leq 2 n+\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor & \leq 2 T_{k}+k \\
k^{2}-k+2+k & \leq & & \leq \\
k^{2}+2 & \leq & g(n) & k^{2}+k+k \\
g(n) & & \leq k^{2}+2 k
\end{array}
$$



Note that when $n$ is in this interval and increases by 1 , then the $2 n$ term causes the value of $g(n)$ to increase by 2 .

Therefore, for the values of $n$ in this interval, $g(n)$ takes precisely the values $k^{2}+2$, $k^{2}+4, k^{2}+6, \ldots, k^{2}+2 k$.

In other words, the range of $g$ over this interval of its domain is precisely the set $\mathcal{S}_{k}$.

As $k$ ranges over all positive integers (that is, as these intervals cover the domain of $g$ ), this tells us that the range of $g$ is precisely the integers in the sets $\mathcal{S}_{1}, \mathcal{S}_{2}, \mathcal{S}_{3}, \ldots$

(We could also include $\mathcal{S}_{0}$ in this list since it is the empty set.)

We note next that $f(1)=2-\left\lfloor\frac{1+\sqrt{8-7}}{2}\right\rfloor=1$, the only element of $\mathcal{Q}_{0}$.

For $k \geq 1$ and $T_{k}+1 \leq n \leq T_{k+1}$, we have $\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor=k+1$ and so

$$
\begin{array}{rlrlrl}
2 T_{k}+2 & \leq & 2 n & \leq & 2 T_{k+1} \\
2 T_{k}+2-(k+1) & \leq 2 n-\left\lfloor\frac{1+\sqrt{8 n-7}}{2}\right\rfloor & \leq & 2 T_{k+1}-(k+1) \\
k^{2}+k+2-k-1 & \leq & f(n) & & \leq & (k+1)(k+2)-k-1 \\
k^{2}+1 & \leq & f(n) & & \leq & k^{2}+2 k+1
\end{array}
$$

Note that when $n$ is in this interval and increases by 1, then the $2 n$ term causes the value of $f(n)$ to increase by 2 .

Therefore, for the values of $n$ in this interval, $f(n)$ takes precisely the values $k^{2}+1$, $k^{2}+3, k^{2}+5, \ldots, k^{2}+2 k+1$.

In other words, the range of $f$ over this interval of its domain is precisely the set $\mathcal{Q}_{k}$.

As $k$ ranges over all positive integers (that is, as these intervals cover the domain of $f$ ), this tells us that the range of $f$ is precisely the integers in the sets $\mathcal{Q}_{0}, \mathcal{Q}_{1}, \mathcal{Q}_{2}, \ldots$

Therefore, the range of $f$ is the set of elements in the sets $\mathcal{Q}_{0}, \mathcal{Q}_{1}, \mathcal{Q}_{2}, \ldots$ and the range of $g$ is the set of elements in the sets $\mathcal{S}_{0}, \mathcal{S}_{1}, \mathcal{S}_{2}, \ldots$ These ranges include every positive integer and do not overlap.