OFFSET
1,5
COMMENTS
The number of even-order elements in a finite abelian group G is |G| - b(|G|), where b is given by A000265. To see this, decompose G as a product of cyclic groups of orders {m_k}. G has [prod_k b(m_k)] elements of odd order, since an element has odd order if and only if all its components have odd order, and each C_m factor has b(m) elements of odd order. Since b can be pulled outside the product, G has b(|G|) elements of odd order. Using that the order of (Z/nZ)^x is phi(n), we obtain a(n) = phi(n) - b(phi(n)).
Since phi(n) is even when n > 2, a(n) is odd when n > 2.
EXAMPLE
For n = 10, the elements of (Z_n)^x with even order are 3 (order 4), 7 (order 4), and 9 (order 2). Thus, a(10) = 3.
MAPLE
a:= n-> (t-> t-t/2^padic[ordp](t, 2))(numtheory[phi](n)):
seq(a(n), n=1..80); # Alois P. Heinz, Apr 14 2020
MATHEMATICA
a[n_] := Length@
Select[Range[n] - 1, EvenQ[MultiplicativeOrder[#, n]] &];
oddPart[n_] := n/2^IntegerExponent[n, 2];
a[n_] := EulerPhi[n] - oddPart[EulerPhi[n]];
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert A. Jones, Apr 13 2020
STATUS
approved