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?



Sequence $(x_n)$ whose first $p$ terms is a complete residue system: value of $\lim\limits_{n\to\infty}\frac{x_n}{n}$?
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](https://www.renyi.hu/~p_erdos/1934-01.pdf). 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.


