Question on factorint matrix modification
[email protected] Sun, 22 Feb 2026 22:03:41 +0100
| Newsgroups | gmane.comp.mathematics.pari.user |
|---|---|
| Message-ID | <[email protected]> |
A recursive function g(n) will call g(n/q) for each prime divisor q of n. It can do so with: F=factorint(n)[,1];foreach(F,q,g(n/q)) But that way each invocation of g() has to factorint its argument and those numbers are big. I want to factor top n once and pass factorization matrix additionally. Just found one way to compute the reduced factorization matrix: ? F=factorint(2^3*7*19^2); ? print(F) [2, 3; 7, 1; 19, 2] ? dec(f,i)=if(f[1]==i,[i,f[2]-1]~,f); ? for(i=1,#F~,M=Mat([g|f<-F~;g<-[dec(f,F~[1,i])],f[1]!=F~[1,i]||f[2]>1])~;print(M)) [2, 2; 7, 1; 19, 2] [2, 3; 19, 2] [2, 3; 7, 1; 19, 1] ? That does what I want and I am happy to have found it. But it looks a bit complex to me for the task. Is there a simpler GP way to determine the factorization matrix of n/q from F? Is there a way without matrix comprehension? Regards, Hermann.