McLaughlin, James on Tue, 04 Sep 2007 05:24:21 +0200


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

polynomial factoring question


What is the best way to get the irreducible factors (over Z) of a polynomial as a list?
 
For example, for x^16-2^16, I would like the output to be
[x - 2, x + 2, x^2 + 4, x^4 + 16, x^8 + 256]
 
facs=factor(x^16-2^16)  gives
[x - 2 1]
[x + 2 1]
[x^2 + 4 1]
[x^4 + 16 1]
[x^8 + 256 1]
 
and facs[3,1] will return x^2+4.
 
ls=[ ]; for(j=1, length(facs), ls=concat(ls, facs[j,1]););  
does not work since length(facs)=2
(this seems strange to me - I would have thought length(facs) = 5?)
 
Maybe there is some simple command in the ? lists that I am missing, but I could not find it.
 
 
Jimmy Mc Laughlin