Source: /cirosantilli/number-of-elements-in-a-farey-sequence

= Number of elements in a Farey sequence
{c}
{wiki}

https://en.wikipedia.org/w/index.php?title=Farey_sequence&oldid=1223364653\#Sequence_length_and_index_of_a_fraction
$$
|F_n| = 1 + \Phi(n)
$$
where $\Phi(n)$ is the <totient summatory function>.