Suppose for every $x \in [0, 1]$, we have a subset $S\_x$ of the natural numbers with asymptotic density $1$ such that if
$n \in S\_x$, there is an open neighbourhood $U$ of $x$ (depending on $x$ and $n$) such that $n \in S\_y$ for all $y \in U$.


**Question:**


For any $\varepsilon > 0$ can I find a subset $M$ of $[0, 1]$ with $\mu(M) > 1 - \varepsilon$, and a subset $K \subset \mathbb N$ of positive upper density satisfying the following condition?


* For all $x \in M$, there exists some $N > 0$ such that $K \cap [N, \infty)$ is a subset of $S\_x \cap [N, \infty)$.


*A word on motivation:* This question arose in trying to prove [this
result](https://mathoverflow.net/questions/393685/almost-arzela-ascoli) on sequences of “almost equicontinuous” functions. The result as stated turns out to be false as shown by Mateusz Kwaśnicki in the comments and Iosif Pinelis in his answer, but I believe if this lemma is true, I can get a subsequence that converges in measure to *some* function $f$, not necessarily continuous.



A density lemma for families of sequences indexed by the unit interval
Define $S\_x=\{n\colon \langle n!x\rangle>\frac 1n\}$, where $\langle \cdot\rangle$ is the fractional part of $\cdot$. Another way to think of this is you can (essentially uniquely) write a number as
$$
x=\sum\_{n=2}^\infty \frac{a\_n(x)}{n!},
$$
where $a\_n(x)\in\{0,\ldots,n-1\}$. This is the expansion of $x$ where the first digit is base 2, the next digit is base 3 etc. $S\_x$ is the set of places where $x$ does not have a zero. Notice that if $x$ is chosen uniformly with respect to Lebesgue measure, then the random variables $a\_n(x)$ are uniform and independent on $\{0,\ldots,n-1\}$. So we see that $S\_x$ has full density for almost all $x$.


Now if $K$ is a subset of $\mathbb N$ of positive density, the probability that $a\_n(x)\ne 0$ for each $n\in K$ is
$$
\prod\_{n\in K}\frac{n-1}n=\prod\_{n\in K}(1-\tfrac 1n).
$$
Since $K$ has positive density, that probability is 0.


In particular, for any $M$ of positive measure, any $K$ of full density and any $N$, $K\cap [N,\infty)$ still has positive density, so we may apply the above to $K\cap [N,\infty)$ to see that the set of $x$'s in $M$ where $K\subset S\_x$ has measure 0.


