OFFSET
1,3
COMMENTS
For n >= 3, let d is the k-th divisor of psi(n)/2. If d is odd, then T(n,k) is the number of elements in (Z/nZ)* having order d or 2*d; otherwise T(n,k) is the number of elements in (Z/nZ)* having order 2*d.
LINKS
Jianing Song, Table of n, a(n) for n = 1..9887 (rows 1..1500)
Jianing Song, List of Q(chi) for characters chi modulo n <= 2048.
Wikipedia, Dirichlet character.
EXAMPLE
Table begins
1,
1,
2,
2,
2, 2,
2,
2, 4,
4,
2, 4,
2, 2,
2, 8,
4,
2, 2, 4, 4,
2, 4,
4, 4,
4, 4,
2, 2, 4, 8,
2, 4,
2, 4, 12,
4, 4.
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
row(n) = if(n<=2, [1], my(invariant_factors=znstar(n)[2], k=lcm(invariant_factors)/2); apply(x->count_order(invariant_factors, 2*x)+if(x%2==1, count_order(invariant_factors, x)), divisors(k)));
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Jianing Song, May 28 2026
STATUS
approved
