Bill Allombert on Thu, 20 Mar 2003 19:28:23 +0100


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

Re: Bug


On Thu, Mar 20, 2003 at 06:06:35PM -0000, Jon Perry wrote:
> {
> dispfact(n)=local(k,kl,v);
> k=factor(n);kl=length(k[,2]);
> v=vector(kl);
> for (i=1,kl,v[i]=concat(concat(k[,1][i],"^"),k[,2][i]));
> v
> }
> 
> Using Pari2.2.5 for Windows, as complied by David Cleaver, the above code
> doesn't work (it works in Pari2.1.3)
> 
> Trying dispfact(12345), where k is length 3, apparently i=3 is too much.

Well I confirm this bug with the CVS version on Linux:
? factor(12345)[,1][3]
  ***   array index (3) out of allowed range [1-2]: factor(12345)[,1][3]
                                                                        ^--

Note that you can get around the problem by rewriting it as
 for (i=1,kl,v[i]=concat(concat(k[i,1],"^"),k[i,2]));

which is cleaner anyway.

Cheers,
Bill.