Bill Allombert on Fri, 25 Jun 2004 17:15:45 +0200


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

Re: divisors() for non-integer arguments


On Fri, Jun 25, 2004 at 02:51:43PM +0200, Jeroen Demeyer wrote:
> Hello all,
> 
> I noticed that the function divisors() only works for integers.
> I'm not a PARI developer, but I'm sure it cannot be hard at all to
> implement it also for polynomials (main difference would probably be
> that sorting doesn't really make any sense).
> I'd do it myself, but the source code is so cryptic.

If you don't mind cryptic code, you can use the GP function below:

div(P)=local(F,L);F=factor(P);L=[];forvec(V=vector(#F[,2],i,[0,F[i,2]]),L=concat(L,[factorback(concat(Mat(F[,1]),Mat(V~)))]));L

Cheers,
Bill.