%I #16 Jun 03 2026 20:37:03
%S 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,
%T 4,12,4,4,4,8,2,8,2,20,8,2,2,8,8,2,2,4,4,2,4,12,4,8,2,2,12,12,4,4,2,4,
%U 8,16,4,4,8,4,16,2,2,4,8,4,4,8,8,4,8,2,2,4,4,12,12
%N Irregular triangle read by rows: T(1,1) = T(2,1) = 1; for n >= 3, the n-th row lists the number of Dirichet characters chi modulo n such that Q(chi) = Q(zeta_(2d)) for each divisor d of psi(n)/2, where Q(chi) is the field generated by the values of chi, and psi = A002322 is the reduced totient function.
%C 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.
%H Jianing Song, <a href="/A396486/b396486.txt">Table of n, a(n) for n = 1..9887</a> (rows 1..1500)
%H Jianing Song, <a href="/A395473/a395473.txt">List of Q(chi) for characters chi modulo n <= 2048</a>.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Dirichlet_character">Dirichlet character</a>.
%e Table begins
%e 1,
%e 1,
%e 2,
%e 2,
%e 2, 2,
%e 2,
%e 2, 4,
%e 4,
%e 2, 4,
%e 2, 2,
%e 2, 8,
%e 4,
%e 2, 2, 4, 4,
%e 2, 4,
%e 4, 4,
%e 4, 4,
%e 2, 2, 4, 8,
%e 2, 4,
%e 2, 4, 12,
%e 4, 4.
%o (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}
%o count_order(invariant_factors, k) = sumdiv(k, d, moebius(k/d)*power_solution(invariant_factors, d)); \\ number of elements of order k
%o 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)));
%Y Cf. A002322, A265120.
%Y Cf. A060594 (first column), A395473 (row lengths), A395683 (rightmost elements of rows).
%K nonn,tabf
%O 1,3
%A _Jianing Song_, May 28 2026