Charles Greathouse on Thu, 05 Aug 2021 16:39:03 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Multiplying two factored numbers


Thanks to fordivfactored and forfactored and all the arithmetic functions accepting [n, factor(n)] it's common to work with the factorization matrix. Is there a convenient way to multiply two factored numbers?

Of course you can hack this together. If n and m are relatively prime, then their factored forms fn = factor(n) and fm = factor(m) can be found with

fmn = concat(fm~, fn~)~

but this is not sorted. So

fmn = vecsort(concat(fm~, fn~), 1)~

and teasing out the common factors should be just a bit more work.

Obviously factor(vecprod(apply(factorback, [fm, fn]))) would work but it defeats the whole purpose of having the numbers factored in the first place.