Let $a$ and $b$ be two positive integers such that $a \le b$.
I want to find a pair of n-uplets of ${\mathbb{N}^{*}}^n$ : $(a_i)_{1 \le i \le n}$ and $(b_i)_{1 \le i \le n}$ for the greatest n possible
such that :
a) $a = \prod_{1 \le i \le n}{a_i}$, $b = \prod_{1 \le i \le n}{b_i}$
b) $\forall 1 \le i \le n , a_i \le b_i $
It seems a good idea to decompose $a$ and $b$ as products of prime numbers and to remark that the $a_i$ and $b_i$ are sub-products of those prime numbers. As far as there are common prime numbers in both decomposition, we can add an $a_i=b_i$ equal to that common number, then we are left with the same problem but where $a$ and $b$ have no common prime numbers in their decomposition.
Context of this problem :
I want to create injection between elements of two "tensors" (I guess that is the correct name) with the simpliest "rules" possible.
ex : $\{1,2,3,4,5\}\times\{1,2\} \times\{1,2,3,4\} \leftarrow \{1,2,3\}\times\{1,2,3\} \times\{1,2,3\} $
There are $b=40$ elements in the first set and $a=27$ in the second.
if $a_1 = 3$, $a_2 = 9$, $b_1=4$ and $b_2=10$, I can "decompose" my injection into
An injection $I_1$ between $\{1,2,3\}$ and $\{1,2,3,4\}$
An injection $I_2$ between $\{1,2,3,4,5\} \times \{1,2\}$ and $\{1,2,3\} \times \{1,2,3\}$
the final injection being $I(i,j,k) = (I_1(k),I_2(i,j))$