TITLE: Sequence $(x_n)$ whose first $p$ terms is a complete residue system: value of $\lim\limits_{n\to\infty}\frac{x_n}{n}$?
QUESTION [10 upvotes]: Let $\{x_{n}\}$ be a sequence in $\mathbb{N}$ with $x_{1}=1$ such that for any prime $p$, the set $$A=\{x_{1},x_{2},\ldots,x_{p}\}$$ forms a complete residue system $\pmod{p}$. Now is it true that $\lim\limits_{n\to\infty}\frac{x_{n}}{n}$ exists? If yes what is it's value?

REPLY [20 votes]: This problem is due to Imre Ruzsa who posed it at the 2015 Miklós Schweitzer Contest in Hungary: https://mathproblems123.wordpress.com/2015/10/31/miklos-schweitzer-2015-problems/
Here is a solution (thanks also to YCor for his comments and encouragement). It is easy to see that $x_1=1$ and $x_2=2$. We claim that $\{x_1,\dots,x_p\}$ equals $\{1,\dots,p\}$ for every prime $p$. Let us assume that this holds for some prime $p$, and let us show that it also holds for the next prime $q$ in place of $p$. For this, it suffices to verify that $x_j\leq q$ holds for any $p<j\leq q$. By assumption, the $p$ consecutive positive integers $x_j-p,\dots,x_j-1$ are not divisible by $q$ or by any larger prime. Hence trivially $x_j\not\in\{q+1,\dots,q+p\}$, but rather nontrivially also $x_j\leq 2p$ by the Sylvester-Schur theorem. As $2p<q+p$, these two relations force that $x_j\leq q$, and we proved the claim. In particular, if $n$ is a positive integer, and $p<n\leq q$ for the consecutive primes $p<q$, then $p/q<x_n/n<q/p$. This implies that $x_n/n\to 1$, because the ratio of consecutive primes tends to $1$ by the prime number theorem.