hermann on Thu, 05 Mar 2026 15:39:55 +0100


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

Questions on operations on factorizations


Recently I learned from Karim Belabas how to do divison of factorizations efficiently using matreduce(matconcat(...)):
https://pari.math.u-bordeaux.fr/archives/pari-users-2602/msg00024.html


I did not find inverse function for factorint() in doc, is there one?
This function does the job, but I would prefer to use builtin and documented function if available:
factval(F)=vecprod([v[1]^v[2]|v<-F~]);


I am working with factorizations a lot lately. Given factorizations f of x and g of y, factorization of x*y can be determined from f and g by factorint(factval(f),factval(g)), but for big numbers factorint() becomes slow. An efficient solution is:
factmul(f1,f2)=matreduce(matconcat([f1,f2]~));



Above are several functions on factorizations (divison, inverse of factorint, multiplication), there might be more that are useful to avoid factorint overhead. Are some of those available in GP already?


Regards,

Hermann.


P.S:
The efficiency of gp is amazing, searching for Carmichael numbers of form N=2^a*3^b+1 up to 10^70 is possible thanks to efficient isprime+divisors+...:
https://gist.github.com/Hermann-SW/7615a6e6121d5f743bf7a4086ccc5672