so I am extremely new to Mathematica and currently doing a project that involves calculating a specific function of the Farey Fractions. That is given an interval $I: (0,\alpha)$, I want to calculate the number of distinct pairs $i$,$j$ s.t $i-j$ $\in I$ in a normalized list of farey fractions. The normalization factor here is $\frac{1}{|F_d-1|}$, where $|F_d|$ is the size of the list of farey fractions with denominator d. So, for example with the denominator being 5, the normal list of Farey fractions is $FareySequence[5]$, while the normalized list is $|F_d-1|(FareySequence[5])$.
Below is my attempt to count the number of distinct pairs $i,j$ which are part of a normalized Farey Sequence such that $i-j<1$, where $i>j$. Here, I am counting it based on fractions with denominator 1000. There are 304193 such fractions. I used a counter, where a count is added everytime there is a pair whose difference is less than 1. However, everytime I run it, the program never evaluates. Any help would be appreciated.
count = 0
For[i = 1, i < 304193, i++,
For[j = 1, j < i, j++,
if[(304193 FareySequence[1000, i]) - (304193 FareySequence[1000,
j]) < 1, count ++, count = count ]
]
]
Print[count]