While reading the statement of Roth's theorem I started asking myself **what are examples of sets of positive upper density**? It's not hard to come up with a few:


* Flip a coin with probability $\mathbb{P}(H) = p < 1$ and take all the heads
* Consider $\{ n : \{ n \theta\} > 0.001$ where $\theta$ is an irrational number


While searching the OEIS I only found a few more:


* $n$ with a prime factor such that $p > \sqrt{n}$ has density $\log 2$
* $n = p + 2^k$ where $k \geq 1$ and $p$ is prime.


Then there are square-free numbers and $\{ n : n^2 + 1 \text{ is square-free} \}$. 


I have been looking through various sources... such as Roth's book who writes very abstractly. In a sense, chosen any correctly-chosen set can have positive upper density, but are there any good examples that you are aware of? 


Erdos may have come up with a few. I considered making my coin-flip example deterministic. 



Examples of Sets with Positive Upper Density
The *Birkhoff ergodic theorem* produces many integer sets of positive upper density. Given a probability space $(X, \mu)$, a transformation $T : X \rightarrow X$ preserving $\mu$, and some measurable set $A \subset X$, we have the convergence for almost all $x \in X$,
$$
{1\over N} Card\{k< N \mid T^k(x)\in A\} \rightarrow E({\bf 1}\_A \mid {\cal I})(x)
$$
where $E({\bf 1}\_A \mid {\cal I})$ is the conditional expectation of the indicatrix function of $A$ with respect to the $\sigma$-algebra ${\cal I}$ of $T$-invariant sets. That function is positive on $A$ for almost all $x$.
So the set of $k$ for which $T^k(x)$ belongs to $A$ has positive upper density for almost all $x\in A$. This is a strengthening of the Poincaré recurrence theorem.


If $T$ happens to be uniquely ergodic and $\mu$ is of full support, as in the example of an irrational rotation $x\mapsto x+\theta$ on the circle, the convergence holds for all x, so this is a bit more explicit.


