For any arithmetic progression $n \in \Bbb{N} : n \equiv b \pmod a$, the natural density is $\frac{1}{a}$? This question comes from here (page 10).  Given that $d(A) := \lim_{x\to\infty}\frac{1}{x}\sharp\{n \leq x : n \in A\}$, how do I get that:


*

*$d(n \equiv b \pmod a) = \lim_{x\to\infty}(\left [ \frac{x}{a}\right ] + O(1))$

*the limit in (1) equals $\frac{1}{a}$.
My attempt at (1): There are exactly $\left [ \frac{x - b}{a} \right ] + \left [ \frac{b}{a} \right ] + 1 $ numbers $n$ that are in the arithmetic progression that are less than $x$.  So where is the need for big-O notation if we have an exact expression?
 A: The number of positive integers $n$ in the arithmetic progression $n \equiv b \bmod a$ up to $X$ is $\lfloor X/a\rfloor + (\text{error}),$ where the error is either $0$ or $1$. It is not necessary to give a more specific description of the error term, as it's already so small.
In fact, it might even be easier to make the error a little bit larger. For a general positive real number $Y$, we have that $Y = \lfloor Y \rfloor + \{Y\}$, where $\lfloor Y \rfloor$ is the largest integer less than $Y$ and $\{Y\} = Y - \lfloor Y \rfloor$ denotes the fractional part.
Then $0 \leq Y - \lfloor Y \rfloor \leq 1$. Applied to our problem, this means that $0 \leq X/a - \lfloor X/a \rfloor \leq 1$.
So the number of positive integers $n$ in the arithmetic progression $n \equiv b \bmod a$ up to $X$ is $X/a + (\text{error})$, where now the error is bounded in magnitude by $2$. In the language of your post, one might write this as
$$ \frac{X}{a} + O(1).$$
To find the natural density, one computes
$$ \lim_{X \to \infty} \frac{1}{X} \bigg( \frac{X}{a} + O(1) \bigg) = \lim_{X \to \infty} \frac{1}{a} + O\bigg(\frac{1}{X}\bigg) = \frac{1}{a}.$$
