A set
$R\subset \mathbb{N}$ is called rational if it is well approximable by finite unions of arithmetic progressions, meaning that for every
$\unicode[STIX]{x1D716}>0$ there exists a set
$B=\bigcup _{i=1}^{r}a_{i}\mathbb{N}+b_{i}$, where
$a_{1},\ldots ,a_{r},b_{1},\ldots ,b_{r}\in \mathbb{N}$, such that
$$\begin{eqnarray}\overline{d}(R\triangle B):=\limsup _{N\rightarrow \infty }\frac{|(R\triangle B)\cap \{1,\ldots ,N\}|}{N}<\unicode[STIX]{x1D716}.\end{eqnarray}$$ Examples of rational sets include many classical sets of number-theoretical origin such as the set of squarefree numbers, the set of abundant numbers, or sets of the form
$\unicode[STIX]{x1D6F7}_{x}:=\{n\in \mathbb{N}:\boldsymbol{\unicode[STIX]{x1D711}}(n)/n<x\}$, where
$x\in [0,1]$ and
$\boldsymbol{\unicode[STIX]{x1D711}}$ is Euler’s totient function. We investigate the combinatorial and dynamical properties of rational sets and obtain new results in ergodic Ramsey theory. Among other things, we show that if
$R\subset \mathbb{N}$ is a rational set with
$\overline{d}(R)>0$, then the following are equivalent:
(a)
$R$ is divisible, i.e.
$\overline{d}(R\cap u\mathbb{N})>0$ for all
$u\in \mathbb{N}$;
(b)
$R$ is an averaging set of polynomial single recurrence;
(c)
$R$ is an averaging set of polynomial multiple recurrence.
As an application, we show that if
$R\subset \mathbb{N}$ is rational and divisible, then for any set
$E\subset \mathbb{N}$ with
$\overline{d}(E)>0$ and any polynomials
$p_{i}\in \mathbb{Q}[t]$,
$i=1,\ldots ,\ell$, which satisfy
$p_{i}(\mathbb{Z})\subset \mathbb{Z}$ and
$p_{i}(0)=0$ for all
$i\in \{1,\ldots ,\ell \}$, there exists
$\unicode[STIX]{x1D6FD}>0$ such that the set
$$\begin{eqnarray}\{n\in R:\overline{d}(E\cap (E-p_{1}(n))\cap \cdots \cap (E-p_{\ell }(n)))>\unicode[STIX]{x1D6FD}\}\end{eqnarray}$$ has positive lower density.
Ramsey-theoretical applications naturally lead to problems in symbolic dynamics, which involve rationally almost periodic sequences (sequences whose level-sets are rational). We prove that if
${\mathcal{A}}$ is a finite alphabet,
$\unicode[STIX]{x1D702}\in {\mathcal{A}}^{\mathbb{N}}$ is rationally almost periodic,
$S$ denotes the left-shift on
${\mathcal{A}}^{\mathbb{Z}}$ and
$$\begin{eqnarray}X:=\{y\in {\mathcal{A}}^{\mathbb{Z}}:\text{each word appearing in}~y~\text{appears in}~\unicode[STIX]{x1D702}\},\end{eqnarray}$$ then
$\unicode[STIX]{x1D702}$ is a generic point for an
$S$-invariant probability measure
$\unicode[STIX]{x1D708}$ on
$X$ such that the measure-preserving system
$(X,\unicode[STIX]{x1D708},S)$ is ergodic and has rational discrete spectrum.