TITLE: Nilpotency of a group by looking at orders of elements
QUESTION [24 upvotes]: For any finite group $G$, let
$$\theta(G) := \sum_{g \in G} \frac{o(g)}{\phi(o(g))},$$
where $o(g)$ denotes the order of the element $g$ in $G$, and where $\phi$ is the Euler totient function.
It is not too hard to see that if $G$ is nilpotent, then $\theta(G)$ is in fact equal to $\sigma(|G|)$, i.e. the sum of the divisors of $|G|$. However, it seems that $\theta(G)$ is always less than or equal to $\sigma(|G|)$, and that equality holds if and only if $G$ is nilpotent.
My question is twofold: (1) Is this claim true? (2) What kind of "natural" properties of groups (such as nilpotency) are there that can be checked by only looking at the orders of the elements of the group?

REPLY [6 votes]: (I post this as an answer, since I don't want to enter the below math into the comment box. It answers Tom de Medt's question on my comment to Robert Guralnick's answer.)
Nilpotency can be checked by looking only at the orders of elements: Write $e_G(k)$ for the number of elements of order $k$ in $G$. As I remarked in that comment, nilpotency of $G$ implies multiplicity of $e_G$ on coprime elements, since $G$ is the direct product of the Sylow subgroups.
Indeed, one can make somewhat more precise statements: Let $p$ be a prime and $|G|_p$ the $p$-part of $|G|$, and note that
$$ \sum_{i\geq 0} e_G(p^i) \geq | G |_p ,$$
with equality if and only if there is only one Sylow $p$-subgroup of $G$. So one can tell from the orders whether $G$ has a normal Sylow $p$-subgroup. $G$ is nilpotent iff all Sylow subgroups are normal.
Looking at the multiplicity of $e_G$ was perhaps more complicated than necessary, but here is a justification of the assertion from my comment: If $e_G$ is multiplicative, then
$$ |G| = \prod_{p } |G|_p
        \leq \prod_{p } \sum_{i\geq 0} e_G(p^i)
        = \sum_{k\geq 0} e_G(k) = |G|, $$
and thus the "$\leq$" must be a "$=$", which again implies all Sylow $p$-subgroups are normal.