Number of pairs $(a, b)$ with $gcd(a, b) = 1$ Given $n\geq1$, how can I count the number of pairs $(a,b)$, $0\leq a,b \leq n$ such that $gcd(a,b)=1$?
I think the answer is $2\sum_{i}^{n}\phi(i)$. Am I right?

Perhaps it could be mentioned that if we consider the probability $P_{n}$ that two randomly chosen integers in $\{1, 2, \dots, n \}$ are coprime
$$
P_{n} = \frac{\lvert \{(a, b) : 1 \le a, b \le n, \gcd(a,b) =1 \}\rvert}{n^{2}},
$$
then
$$
\lim_{n \to \infty} P_{n} = \frac{6}{\pi^{2}}.
$$
See this Wikipedia article.
