OFFSET
1,2
COMMENTS
Note that {Kronecker(D,i)} is a Dirichlet character mod |D| if and only if D == 0, 1 (mod 4).
We have the identity: -Sum_{i=1..D} Kronecker(-D,i)*i^2 = D*b(D). Proof: -Sum_{i=1..D} Kronecker(-D,i)*i^2 = -(1/2)*Sum_{i=1..D} (Kronecker(-D,i)*i^2+Kronecker(-D,D-i)*(D-i)^2) = -(1/2)*Sum_{i=1..D} (Kronecker(-D,i)*(i^2-(D-i)^2)) = -(1/2)*Sum_{i=1..D} (Kronecker(-D,i)*(2*D*i-D^2) = D*b(D) + (D^2/2)*(Sum_{i=1..D} Kronecker(-D,i)) = D*b(D).
LINKS
Jianing Song, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Class Number
Eric Weisstein's World of Mathematics, Dirichlet L-Series
FORMULA
Let c(D) = b(D)/D = -(1/D)*(Sum_{i=1..D} Kronecker(-D,i)*i). Let -d be the unique fundamental discriminant (i.e., d is in A003657) such that D/d is a square, then c(D) = 2*h(-d)/w(-d) * Product_{primes p|D} (1-Kronecker(-d,p)), where h(-d) is the class number of K = Q[sqrt(-d)], w(-d) is the number of elements in K whose norms are 1 (w(-d) = 6 if d = 3, 4 if d = 4 and 2 if d > 4). This can be seen as the generalization of the well known class number formula: if -d is a fundamental discriminant then c(d) = 2*h(-d)/w(-d). See my notes in the Links section.
b(D) = 0 if and only if there exists a prime p being a factor of D such that if we write D = p^e * s, gcd(p,s) = 1, then e is even and Kronecker(-s,p) = 1; if p = 2, then s == 7 (mod 8).
If -d is a fundamental discriminant, then Sum_{k>=1} Kronecker(-d,k)/k = 2*Pi*h(-d)/(sqrt(d)*w(-d)) = Pi*c(d)/sqrt(d) = Pi*b(d)/d^(3/2). Here Sum_{k>=1} Kronecker(-d,k)/k is the value of the Dirichlet L-series of a non-principal character modulo d at s=1.
EXAMPLE
For n = 7, D = 15, b(15) = -(1 + 2 + 4 - 7 + 8 - 11 - 13 - 14) = 30, which is equal to 15*h(-15). Note that the class number of Q[sqrt(-15)] is 2.
For D < 100, b(D) = 0 for D = 28 = 7*2^2, 60 = 15*2^2, 72 = 8*3^2, 92 = 23*2^2, 99 = 11*3^2 and 100 = 4*5^2, where -7, -15, -8, -23, -11 and -4 are fundamental discriminants. Note that Kronecker(-7,2) = Kronecker(-15,2) = Kronecker(-8,3) = Kronecker(-23,2) = Kronecker(-11,3) = 1. On the other hand, for D = 213444 = 4*231^2, we have c(213444) = 2*h(-4)/w(-4) * (1-Kronecker(-4,3))*(1-Kronecker(-4,7))*(1-Kronecker(-4,11)) = 4 and b(213444) = 213444*4 = 853776.
MATHEMATICA
b[n_] = -Sum[KroneckerSymbol[n, i]*i, {i, 1, n}];
a[n_] = b[2 n + Mod[n, 2]]
PROG
(PARI) b(n) = -sum(i=1, n, kronecker(-n, i)*i)
a(n) = b(2*n + (n%2))
CROSSREFS
KEYWORD
nonn
AUTHOR
Jianing Song, Nov 18 2019
STATUS
approved