Count rational numbers in lowest terms in $[0,1]$ I was wondering if there is a formula for the count of rational numbers $\frac{p}{q}$ in lowest terms in $[0,1]$ similar to the sequence in this answer.
For example:


*

*For $q = 1$ we have two: $\{\frac{0}{1}, \frac{1}{1}\}$

*For $q = 2$ we have one: $\{\frac{1}{2}\}$

*For $q = 3$ we have two: $\{\frac{1}{3}, \frac{1}{2}\}$

*For $q = 4$ we have two: $\{\frac{1}{4}, \frac{3}{4}\}$

*For $q = 5$ we have four: $\{\frac{1}{5}, \frac{2}{5}, \frac{3}{5}, \frac{4}{5}\}$

*For $q = 6$ we have two: $\{\frac{1}{6}, \frac{5}{6}\}$

*For $q = 7$ we have six: $\{\frac{1}{7}, \frac{2}{7}, \frac{3}{7}, \frac{4}{7}, \frac{5}{7}, \frac{6}{7}\}$

*and so on...


So we have a total of $19$ rational numbers in lowest terms with $q \le 7$. I'd be happy with the total count for all $q \le N$ too.

Your question is related to Euler's totient function. In particular, the total number of fractions $p/q$, where $1\le p < q$, and $\gcd(p,q)=1$ equals $\varphi(q)$, where $\varphi(\cdot)$ is the Euler's totient function. Consequently, the required number of fractions is 
$$2+\sum_{q=2}^{N} \varphi(q).$$
