In the Plato's dialogue "Theaetetus", at a certain point, we have the following "problem" \begin{align*} 5040 &= 7! \\ &= 1\times 2 \times 3 \times 4 \times 5 \times 6 \times 7 \\ &= 2 \times 3 \times 2 \times 2 \times 5 \times 2 \times 3 \times 7 \\ &= 2^4 \times 3^2 \times 5 \times 7 \\ &= 2^4 \times 3^2 \times 5 \times 7 \end{align*}
Then we should find the number of divisors of $5040$ as $$5 \times 3 \times 2 \times 2 - 1 = 59$$
where the numbers $5, 3, 2$ and $2$ should come apparently respectively from the exponents ($+1$) of the terms in $ 2^4 \times 3^2 \times 5 \times 7$.
My questions is
Where does this formula come from exactly?
For example, I understood we can divide $5040$ by $2$, $2^2$, $2^3$, $2^4$, $3$, $3^2$, $5$ and $7$, and by any combination of products of these numbers, but I don't understand exactly what's the reasoning that has been done to obtain that formula.
I'm very bad in facing problems related to combinations and permutations. Any advice on how to improve this defect? Any specific book or set of exercises that you advise me?
Suppose a number $N$ has prime decomposition $N=p_1^{\alpha_1}p_2^{\alpha_2}\cdots p_k^{\alpha_k}$
We recognize that due to the properties of prime numbers, every divisor of $N$ can be written in the form $p_1^{\beta_1}p_2^{\beta_2}\cdots p_k^{\beta_k}$ with $0\leq \beta_i\leq \alpha_i$ for every $i$.
We recognize further that every tuple of the form $(\beta_1,\beta_2,\dots,\beta_k)$ satisfying those conditions can be related to some divisor uniquely and every divisor can be uniquely associated with a tuple of that form. In other words, these are in bijection with one another.
We ask, how many tuples $(\beta_1,\beta_2,\dots,\beta_k)$ of integers exist that satisfy $0\leq \beta_i\leq \alpha_i$ for every $i$.
We approach via multiplication principle.
The total number of divisors (including $1$ and $N$) is then $\prod\limits_{i=1}^k (\alpha_i+1)$
As an example, $12=2^2\cdot 3^1$ has the following six divisors: $1=2^0\cdot3^0, 2=2^1\cdot 3^0, 3=2^0\cdot 3^1, 4=2^2\cdot 3^0, 6=2^1\cdot 3^1, 12=2^2\cdot 3^1$
As for advice on combinations and permutations questions, this question for example had nothing to do with either of them. It was more fundamental, relating back to the multiplication principle. Combinations and permutations too can be related back to the multiplication principle (possibly using some additional arguments related to symmetry).