TITLE: Only odd primes?
QUESTION [18 upvotes]: For $k \ge 2$, let
$$u = \{\lfloor{(k - \sqrt{k})n}\rfloor : n \ge 1\}$$
$$v = \{\lfloor{(k + \sqrt{k})n}\rfloor : n \ge 1\}.$$
My computer suggests that $u$ and $v$ are disjoint if and only if $k$ is an odd prime.  Can someone give a reference, proof, or counterexample?

REPLY [32 votes]: If $k$ is odd and not a perfect square, then the sets are disjoint. In particular, if $\alpha = \frac{k - \sqrt{k}}{\frac{k-1}{2}}$ and $\beta = \frac{k + \sqrt{k}}{\frac{k-1}{2}}$, then $\alpha$ and $\beta$ are irrational and $\frac{1}{\alpha} + \frac{1}{\beta} = 1$. Therefore, by Beatty's theorem,
$A = \{ \lfloor \alpha n \rfloor : n \geq 1 \}$ and $B = \{ \lfloor \beta n \rfloor : n \geq 1 \}$ form a partition of the positive integers. The sets $u$ and $v$ are subsets of $A$ and $B$ respectively (in particular those with $\frac{k-1}{2} \mid n$).
In particular, the sets $u$ and $v$ are disjoint for $k = 15$, which is the smallest non-prime odd number that is not a perfect square.

REPLY [20 votes]: This is a supplement to Jeremy Rouse's nice answer. Let $\alpha$ and $\beta$ be positive irrational numbers. Skolem proved in 1957 (see Theorem 8 in On certain distributions of integers in pairs with given differences) that the Beatty sequences $[\alpha n]$ and $[\beta n]$ are disjoint if and only if $a/\alpha+b/\beta=1$ holds for some positive integers $a$ and $b$. It follows that the OP's sets $u$ and $v$ are disjoint if and only if $k$ is odd and not a perfect square.