# Is weight sum of Dirichlet character always an algebraic integer (up to power of $2$ and $3$)?

Let $$\chi: (\mathbb Z/N\mathbb Z)^{\times} \rightarrow \mathbb C^{\times}$$ be a character, consider

$$a=\frac{1}{N}\sum_{i=1}^N \chi(i)i$$

where $$\chi(n)=0$$ if $$n$$ is not coprime to $$N$$.

If $$\chi$$ is the Legendre symbol assigned to an imaginary quadratic field, then $$a$$ is an algebraic integer up to power of $$2$$ and $$3$$, because $$a$$ is essentially the class number by the class number formula.

Presumably the question is whether there exists natural numbers $$\ell,m$$ such that $$2^\ell\cdot3^ma$$ is an algebraic integer.
A bit of testing gave the following example. Let's use $$N=25$$. In that case $$2$$ is a generator of $$\Bbb{Z}_N^*$$. Let's try a quartic character defined by $$\chi(2^t)=i^t$$. I will denote by $$s(t)$$ the smallest positive remainder of $$2^t$$ modulo $$25$$ The sum becomes \begin{aligned} \sum_{t=0}^{19}i^ts(t) &=1+2 i-4-8 i+16+7 i-14-3 i+6+12 i\\ &\quad-24-23 i+21+17 i-9-18 i+11+22 i-19-13 i\\ &=-15-5i. \end{aligned} Implying that $$a=-(3+i)/5$$ which is not of the required form.
If the numerator were $$\phi(N)$$ instead of $$N$$ then it might be related to an inner product of group characters, but I'm not sure about that either. I picked $$N=25$$ for my first test because then $$\phi(N)$$ has prime factors $$>3$$. Why do you think these sums would have that form?
• If $N$ is a prime number, maybe that's true. – sawdada Dec 24 '18 at 20:55