Using summation of Euler Phi Function to calculate the number of possible positive slopes in a n x n grid

49 Views Asked by At

Background:

Suppose I have a n x n grid in the Cartesian plane with the origin at the bottom left-hand corner and I wish to find the number of co-prime integer pairs in this n x n grid. The reason for this is because I actually want to find the maximum of amount of positive slopes in an n x n grid from the origin. Where the all points have to be on the grid. I know that the number of co-prime integer pairs is equal to the number of positive slopes. (I think this true , but I am not sure how to prove it).

However, lets try and use the Summation of Euler $\varphi$ function. For example lets say I have a 5 x 5 grid.

5 x 5 Grid

I know from just finding them by hand that there exists 11 points that give all the possible positive slopes from the origin. These are (1,4), (3,4), (1,3), (2,3), (4,3), (1,2), (3,2), (1,1), (2,1), (3,1), (4,1).

But if I try and use the summation of Euler's Phi function to try and find the no. of co-prime integer pairs and therefore the total amount of positive slopes possible.

\begin{equation} \Phi(n)\stackrel{\text{def}}{=}\sum_{k=1}^n \varphi(k) \end{equation}

\begin{equation} \Phi(n)=\sum_{k=1}^n \left(\prod_{p \vert k}\left(1-\frac{1}{p}\right)\right) \end{equation}

computing $\Phi(n)$ for n = 5 gives,

\begin{equation} \Phi(5)=\sum_{k=1}^5 \left(\prod_{p \vert k}\left(1-\frac{1}{p}\right)\right) = 0 + 1 + 2 + 2 + 4 = 9 \end{equation}

Therefore we say we have 9 co prime integer pairs,

I know that when we did it by hand we took also (1,1) and (4,3) and (3,4), I know that in the sum of Euler's phi function it does not care about the order (n,k) or (k,n) and it does not take (1,1) either and that explains they there is a two point difference but

Question:

How do I use the summation of Euler's Phi Function to calculate for example the amount of possible positive slopes in a 6 x 6 grid, 7 x 7 grid... n x n grid?