Karim Belabas on Thu, 05 Aug 2021 17:54:31 +0200


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

Re: Multiplying two factored numbers


* Charles Greathouse [2021-08-05 16:39]:
> 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.

matreduce(fmn) should do the job (applies to arbitrary factorizations,
not only integers).

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux         Fax: (+33) (0)5 40 00 21 23
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`