OFFSET
1,3
COMMENTS
EXAMPLE
For n=5, the Farey sequence (completely reduced fractions) is [0/1, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 1/1]. The distinct lengths between consecutive points are {1/5, 1/20, 1/12, 1/15, 1/10} so a(5) = 5.
MATHEMATICA
a[n_] := FareySequence[n] // Differences // Union // Length;
Table[a[n], {n, 1, 70}] (* Jean-François Alcover, Jul 16 2022 *)
PROG
(Python)
from fractions import Fraction
from itertools import chain
def compute(n):
marks = [[(a, b) for a in range(0, b + 1)] for b in range(1, n + 1)]
marks = sorted(set([Fraction(a, b) for a, b in chain(*marks)]))
dist = [(y - x) for x, y in zip(marks, marks[1:])]
return len(set(dist))
(PARI) vp(n) = my(list = List()); for (k=1, n, for (i=0, k, listput(list, i/k))); vecsort(list, , 8);
a(n) = my(v=vp(n)); #Set(vector(#v-1, k, abs(v[k+1]-v[k]))); \\ Michel Marcus, Jul 10 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Travis Hoppe, Jul 09 2022
STATUS
approved