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

 Multiplying two factored numbers

• To: pari-users@pari.math.u-bordeaux.fr
• Subject: Multiplying two factored numbers
• From: Charles Greathouse <crgreathouse@gmail.com>
• Date: Thu, 5 Aug 2021 10:38:34 -0400
• Delivery-date: Thu, 05 Aug 2021 16:39:03 +0200
• Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=SXNTj24ECKiYy8MMOymHBjvhcDmB3s5MslfOrKC0JPk=; b=LKOsbplN5XpQOiGpObrivkQBJoXWYuKMfqjwWQtzzCw/Df+gEWc8dekEf0l2sXTbdK brSCpy9YD40KgFRrh3p1GcrIKsxGDr6tVOG0OEzFwprMeXdFtvYBlDKtgkGQWwrat2QA p7KxOCA8q0vNpEGpN2c8IUzmuO0JCXr5zCsU2Ol3gIrc1AIYDUh/z6vp5KumMnxkylyf IU1oS8rE4g+QHqf73EjCaG5nzHABmB/d7un/clHQrjK0CAlquxTV9ZaCaj39ChMqdVF6 Y2ww+SVjdWz9H/RJEv1FEQFTK4FG/25ZtJ54+DwRXWrcShqdhMnMDEFBGohUeYIGFAXJ 2f/w==

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.