Find the divisors of $5040$ in the Plato's dialogue "Theaetetus" 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?
 A: 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.


*

*Pick the value of $\beta_1$: there are $\alpha_1+1$ choices, namely $\{0,1,2,\dots,\alpha_1\}$

*Pick the value of $\beta_2$: there are $\alpha_2+1$ choices

*$\vdots$

*Pick the value of $\beta_k$: there are $\alpha_k+1$ choices.


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).
A: There is a basic counting principle called the product rule, which says the following: in an experiment consisting of two steps, if the number of ways to do the first step is $n_1$, and the number of ways to do the second step is $n_2$ for each of the $n_1$ outcomes in the first step, then the total number of possible outcomes for the experiment is the product $n_1 n_2$. The product rule generalizes to experiments with more than $2$ steps. For example, the number of vehicle license plates consisting of three lower case letters followed by three digits is $26^3 \cdot 10^3$ because the first blank can be filled in 26 ways, the second blank can be filled in 26 ways regardless of how the first blank is filled, and so on.  
How many divisors does $2^4 \cdot 3^2 \cdot 5 \cdot 7$ have?  If $d$ is a divisor of this number, then $d$ is of the form $2^a 3^b 5^c 7^d$, where $a \in \{0,1,2,3,4\}, b \in \{0,1,2\}$ and $c, d \in \{0,1\}$.  The number of ways to choose $a$ is $5$, the number of ways to choose $b$ is $3$, and the number of ways to choose $c$ and $d$ are $2$ each.  By the product rule, we get that the number of divisors is $5 \cdot 3 \cdot 2 \cdot 2$. Of course, this includes the special case $a=b=c=d=0$ corresponding to the divisor $1$ and the special case $a=4, b=2, c=d=1$ corresponding to the divisor $5040$. If you are counting only the number of proper divisors, then $5040$ should not be counted and so we subtract $1$ from the product.
The product rule is discussed in Kenneth Rosen's text Discrete Mathematics and its Applications.
