My first thought is to use prime factorisations. I think the most convenient notation for prime factorisation is to use an infinite product and allow exponents to equal 0. This has the added advantage that we don't have to treat 1 as a special case.
where for simplicity we let
We have that
We also have that
So we have which is true if and only if either or , or both. Can you show how this last part is equivalent to ?
(Fixed a small typo)
But if we instead write
this gives us flexibility when comparing the prime factorisations of two different integers, because we can just match up each corresponding index without having to use notation to indicate the highest non-zero index, etc.