OFFSET
1,3
COMMENTS
Let psi = A002322 be the reduced totient function. Since Q(zeta_d) = Q(zeta_(2d)) for odd d, Q(chi) is the maximum when chi has order psi(n), or psi(n)/2 if psi(n) == 2 (mod 4). For any character chi', Q(chi') is a subfield of this maximum Q(chi) = Q(zeta_{psi(n)}).
For n >= 3, number of elements of order psi(n) in (Z/nZ)* if 4 | psi(n), and number of elements of order psi(n) or psi(n)/2 if psi(n) == 2 (mod 4).
LINKS
Jianing Song, Table of n, a(n) for n = 1..10000
Jianing Song, List of Q(chi) for characters chi modulo n <= 2048.
Wikipedia, Dirichlet character.
FORMULA
For p prime, a(p) = EulerPhi(p-1) if p == 1 (mod 4), 2*EulerPhi(p-1) if p == 3 (mod 4).
For p prime and e >= 2, a(p^e), a(p^e) = EulerPhi(p-1)*(p-1)*p^(e-2) if p == 1 (mod 4), 2*EulerPhi(p-1)*p^(e-2) if p == 3 (mod 4); a(2^e) = 2^(e-2) for e >= 4.
EXAMPLE
If n is a divisor of 24, then Q(chi) = Q for every chi modulo n, so a(n) is just the number of Dirichlet characters, namely EulerPhi(n).
If p == 3 (mod 4) is prime, then Q(chi) reaches the maximum (namely Q(zeta_{(p-1)*p^(e-1)})) whenever chi has order (p-1)*p^(e-1) or (p-1)*p^(e-1)/2, so a(p^e) = 2*EulerPhi((p-1)*p^(e-1)).
If p == 1 (mod 4) is prime, then Q(chi) reaches the maximum (namely Q(zeta_{(p-1)*p^(e-1)})) only when chi has order (p-1)*p^(e-1), so a(p^e) = EulerPhi((p-1)*p^(e-1)).
PROG
(PARI) power_solution(invariant_factors, k) = vecprod(apply(x->gcd(x, k), invariant_factors)); \\ number of solutions to x^k = 1 in C_{k_1} X ... C_{k_r}
count_order(invariant_factors, k) = sumdiv(k, d, moebius(k/d)*power_solution(invariant_factors, d)); \\ number of elements of order k
a(n) = my(invariant_factors=znstar(n)[2], k=lcm(invariant_factors)); if(k%4==2, count_order(invariant_factors, k)+count_order(invariant_factors, k/2), count_order(invariant_factors, k));
CROSSREFS
KEYWORD
nonn
AUTHOR
Jianing Song, Jun 03 2026
STATUS
approved
