OFFSET
0,2
COMMENTS
Using d <= 2n or d <= 2n-1 gives the same result, therefore we use 2n and not just n for the upper limit of the denominator. Indeed, using an even d will only yield the same simplified fractions with odd denominators as one gets for d/2.
FORMULA
a(n) = 2*A099957(n)+1 for n > 0.
EXAMPLE
For n = 0, there is no possible fraction, since the denominator can't be zero.
For n = 1, we have a(1) = #{ -1/1, 0/1, 1/1} = 3; using denominator d = 2 would not give other elements with odd denominator after cancellations, cf. comments.
For n = 2, we have a(2) = #{-1/1, -2/3, -1/3, 0, 1/3, 2/3, 1/1} = 7.
For n = 3, we have a(3) = #{-1/1, -4/5, -2/3, -3/5, -2/5, -1/3, -1/5, 0, 1/5, 1/3, 2/5, 3/5, 2/3, 4/5, 1/1} = 15. As explained in comments, only odd d are useful.
PROG
(PARI) a(n)=#Set(concat([[c/d|c<-[-d..d], d && denominator(c/d)%2]|d<-[0..n*2]])) \\ For illustration only. Remove the # to see the elements. Obviously the code could be optimized.
(PARI) apply( {A360452(n) = sum(i=0, n-1, eulerphi(2*i+1))*2+!!n}, [0..10]) \\ This should be used to define the "official" function A360452.
(Python)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
M. F. Hasler, Mar 26 2023
STATUS
approved