Let $n,m \in \mathbb{N}$ $$n=\prod_{i=1}^{r}p_{i}^{a_i}$$ where $p_i$ are prime factors and $f$ , $g$ and $h$ are the functions $$f(n,m)=\sum_{j=1}^{n}j^m$$ And $$g(n)=\sum_{i=1}^{r}a_i.p_i$$ If we put $m=1,n=21$ then $$g(f(21,1))=g(231)=21.$$
21 is only number satisfy $g(f(n,1))=n$.
Now let
$$h(m) = \sum_{g(f(n,m))=n}1$$
So $h(1)=1$.
Question
If $m$ have finite $n$ satisfied $g(f(n,m))=n$ then what is formula for $h(m)$?
Can we prove there are infinitely many $m$ satisfying above statement?