How many ordered pairs $(a, b)$ of positive integers $a$ and $b$ are there such that $\gcd(a, b)= 1$ and $1\leq a,b\leq N$?
My approach is as follows.
Note that $a= b$ only when $a= b= 1$. So this will always give one solution. Now consider the case when $a$ is not equal to $b$. By symmetry assume $a>b$. We can multiply by $2$ later go get our final answer. Now for $N$ let the answer be $f(N)$. Now we need to find the number of ordered pairs $(a, b)$ of positive integers $a$ and $b$ are their such that $\gcd(a, b)= 1$ and $1\leq a<b\leq N+1$. Note that $f(N+1)= f(N) + \phi(N+1)$. This is because $1\leq a<b\leq N$ has $f(N)$ solutions, so $1\leq a<b\leq N+1$ also has these $N$ solutions, but in addition when calculating $f(N+1)$ we can set $b= N+1$ and get $\phi(N)$ possible values of $N$. So $f(N+1)= f(N) + \phi(N)$. Thus solving this recurrence relation we get $$f(N)= \phi(N) + \phi(N-1) + \dots + \phi(4) + f(3)= \phi(N) + \phi(N-1) + \dots + \phi(4) + 2.$$
My question is, is my approach correct here? Can we further simplify $$\phi(N) + \phi(N-1) + \dots + \phi(4) + f(3)= \phi(N) + \phi(N-1) + \dots + \phi(4) + 2\text{ ?}$$
Note:- the original question was to find the number of ordered pairs $(a, b)$ of positive integers $a,b$ such that $1\leq a,b\leq 50$ and $\gcd(a, b)= 1$.