Ways to calculate number by multiplying I am trying to calculate how many ways there are to calculate the same number by multiplying 3 smaller or same numbers. But with only one permutation of the three given numbers.
For example number 6 can be calculated by
1 * 1 * 6 = 6
2 * 3 * 1 = 6

but it can also by calculated by the following permutations of [ 1, 1, 6 ], but I want to count it only as a one option
1 * 6 * 1 = 6
6 * 1 * 1 = 6

I know how to achive this by using s very slow algorithm of 3 embedded for cycles, so is there any mathematical trick on how to do this better?
Thank you in advance.
Edit:
This is for numbers within <1; n> of N where n is the givin number.
Pseudocode solution would be apprecieted.
 A: Decomposing the number
into prime factors,
write
$n
=\prod_{p \in P} p^{v_p(n)}
$
where
$P$ is the set of primes
and
$v_p(n)$
is the exponent for which
$p^v$ exactly divides $n$
(i.e.,
$p^{v_p(n)} \mid n$
and
$p^{v_p(n)+1} \not\mid n$.
If you want to
see how many ways
$n$
can be written as the
product of $m$ factors,
let these factors be
$(n_k)_{k=1}^m$
so that
$n
=\prod_{k=1}^m n_k
$.
Since
$n_k
=\prod_{p \in P} p^{v_p(n_k)}
$,
by unique factorization
we have
$v_p(n)
=\sum_{k=1}^mv_p(n_k)
$.
The problem is now reduced
to finding
the number of ways
each exponent
of each prime that divides $n$
can be written as
the sum of
$m$ non-negative values.
Your turn.
A: to find the number of way to create $x$ you can do the following:
$$x=\begin{cases}[x,1,1]\\ [p,q,1]\\ [a,b,c]\end{cases}$$
for the first case you dont need to work. for the second case you need to do some search:
for which $i\in\Bbb N, i\in [2,\sqrt x]$ you have $x\equiv0\pmod{i}$
all the possible ways to create the number $x$ in the second way will be $\left[i,\frac xi,1\right]$
now the third way will be the trickiest:
first of all you have to note that $[a,b,c]=[a\times b,c,1]$ so you can repeat on the second part but instead of searching for which $i$ you have $x\equiv0\pmod{i}$ you will seach for which $j$ you have $i\equiv0\pmod{j}$ and $\frac xi\equiv0\pmod{j}$
