login
A382117
a(n) = sum (-1)^(((x - 1)*(y - 1))/4), where x and y are coprime positive integers, equidistant from n, such that x <= y.
0
1, 1, 1, 2, 0, 2, 1, 4, 1, 4, 1, 4, 0, 6, 0, 8, 0, 6, 1, 8, 2, 10, 1, 8, 0, 12, 1, 12, 0, 8, 1, 16, 2, 16, 0, 12, 0, 18, 0, 16, 0, 12, 1, 20, 0, 22, 1, 16, 1, 20, 0, 24, 0, 18, 0, 24, 2, 28, 1, 16, 0, 30, 2, 32, 0, 20, 1, 32, 2, 24, 1, 24, 0, 36, 0, 36, 2, 24
OFFSET
1,4
COMMENTS
Sequence inspired by the law of quadratic reciprocity.
EXAMPLE
a(4)=2 because (-1)^(((1 - 1)*(7 - 1))/4) + (-1)^(((3 - 1)*(5 - 1))/4) = (-1)^0 + (-1)^2 = 1 + 1 = 2.
PROG
(PARI) a(n) = sum(x=1, n, my(y=2*n-x); if ((x<=y) && (gcd(x, y)==1), (-1)^(((x-1)*(y-1))/4))); \\ Michel Marcus, Apr 27 2025
CROSSREFS
Cf. A309812 (indices of zeros).
Sequence in context: A337563 A278648 A353508 * A029181 A261426 A260574
KEYWORD
nonn
AUTHOR
Mike Jones, Apr 26 2025
EXTENSIONS
More terms from Alois P. Heinz, Apr 26 2025
STATUS
approved