18
Given a positive integer \$n\$ you can always find a tuple \$(k_1,k_2,...,k_m)\$ of integers \$k_i \geqslant 2\$ such that \$k_1 \cdot k_2 \cdot ... \cdot k_m = n\$ and $$k_1 | k_2 \text{ , } k_2 | k_3 \text{ , } \ldots \text{ , }k_{m-1}|k_m.$$ Here \$a|b\$ means \$b\$ is a multiple of \$a\$, say "a divides b". If \$n>1\$ all entries \$k_i\$ must be at least \$2\$. For \$n=1\$ we have no such factor and therefore we get an empty tuple.
In case you're curious where this comes from: This decomposition is known as invariant factor decomposition in number theory and it is used in the classification of finitely generated Abelian groups.
Challenge
Given \$n\$ output all such tuples \$(k_1,k_2,...,k_m)\$ for the given \$n\$ exactly once, in whatever order you like. The standard sequence output formats are allowed.
Examples
1: () (empty tuple)
2: (2)
3: (3)
4: (2,2), (4)
5: (5)
6: (6)
7: (7)
8: (2,2,2), (2,4), (8)
9: (3,3), (9)
10: (10)
11: (11)
12: (2,6), (12)
108: (2,54), (3,3,12), (3,6,6), (3,36), (6,18), (108)
Related: http://oeis.org/A000688, List all multiplicative partitions of n
May we output each tuple in reverse order? (e.g.
12,3,3
) – Arnauld – 2019-09-09T14:50:51.8801@Arnauld Yes, I think as long as it is sorted in ascending or descending order it should be ok! – flawr – 2019-09-09T15:33:29.810
Can we limit input to integers >= 2? If not this would invalidate some of the existing answers? – Nick Kennedy – 2019-09-09T17:43:28.550
1No, the specs say clearly that any positive integer can be given as input which includes $n=1$. If I change it now everyone who actually adheres to the specs would have to change their answer. – flawr – 2019-09-09T19:21:23.913