Suppose $\mathfrak{U}$ is a group variety. Let’s define $N_{\mathfrak{U}} \subset \mathbb{N}$ as a such set of numbers, that for any finite group $G$, $|G| \in N_{\mathfrak{U}}$ implies $G \in \mathfrak{U}$.

Examples:

If $\mathfrak{O}$ is the variety of all groups, then $N_{\mathfrak{O}} = \mathbb{N}$.

If $\mathfrak{B}_m$ is the variety of all groups of exponent $m$, then $N_{\mathfrak{B}_m}$ is the set of all divisors of $m$

If $\mathfrak{N}_c$ is the variety of all groups of nilpotency class $c$, then $N_{\mathfrak{N}_c}$ is the set of all numbers $n=p_1^{e_1}\cdots p_m^{e_m}$ with $p_i^k\not\equiv 1(\mod p_j)$ for $i,j\in\{1,\ldots,m\}$ and $1\leqslant k\leqslant e_i$, and $e_i \leq c + 1$ for $i\in\{1,\ldots,m\}$.

If $\mathfrak{U}$ and $\mathfrak{V}$ are two varieties, then $N_{\mathfrak{U}\cap\mathfrak{V}} = N_{\mathfrak{U}} \cap N_{\mathfrak{V}}$

My question is:

Does there exist some number-theoretic characterisation of all such subsets $N \subset \mathbb{N}$, such that $N = N_{\mathfrak{U}}$ for some variety $\mathfrak{U}$?

Any $N_{\mathfrak{U}}$ satisfies the property:

If $a \in N_{\mathfrak{U}}$ and $b | a$, then $b \in N_{\mathfrak{U}}$

Suppose $|G| = b$ and $G \notin \mathfrak{U}$. Then $G \times C_{\frac{a}{b}} \notin \mathfrak{U}$.

If $\exists n \in \mathbb{N}$, such that $\forall k \in \mathbb{N}$ $n^k \in N_{\mathfrak{U}}$, then $\mathfrak{U} = \mathfrak{O}$.

By previous lemma, we can assume without loss of generality, that $n = p$ is prime. The only variety, that contains all $p$-groups for a fixed prime $p$ is $\mathfrak{O}$

However, I am not sure, whether those two conditions are sufficient to characterise all such sets or not.

This question was inspired by this MO question


This is not an answer, but an observation. You have already done enough work to answer the restricted form of the question where variety of groups is replaced with variety of abelian groups.

Any proper variety of abelian groups is axiomatized by the laws of abelian groups together with $x^m = 1$ for some $m$. Thus if $\mathfrak{U}$ is a variety of abelian groups, then $N_{\mathfrak{U}}$ must equal the set of all positive integers or else the set of divisors of $m$ for some positive $m$.