Bill Allombert on Fri, 2 Apr 1999 15:31:46 +0200 (MET DST)

 Re: idealstar()

```The bug is in zprimestar:

this function only handles correctly :
_the case p<<2^32
_the case f=pr[4]=1

So idealstar(K,2^61-1) works (f=1)
but not
idealstar(K,2^31-1) nor idealstar(K,2^31+129) (f=4)

--------base3.c--1151---
zprimestar(GEN nf,GEN pr,GEN ep,GEN x,GEN arch)
{
long av=avma,av1,N,f,nbp,j,n,m,tetpil,i,e,a,b;
GEN prh,p,pefm1,list,v,p1,p2,p3,p4,prk,uv,g0,newgen,pra,prb;
GEN *gptr[2];

if(DEBUGLEVEL>=4)
{ fprintferr("on traite pr = %Z ^ %Z\n",(long)pr,(long)ep); flusherr(); }
prh=prime_to_ideal(nf,pr); N=lg(prh)-1;
f=itos((GEN)pr[4]); p=(GEN)pr[1];

if(DEBUGLEVEL>=4) {fprintferr("prh etc... calcule\n");flusherr();}
v = zerocol(N);
if (f==1) v[1]=gener(p)[2];
-----^^^^^^----------------------------f==1:OK
else
{
GEN prhall = cgetg(3,t_VEC);
long psim = itos(p);
----------------^^^^------------------------------itos: p<2^31-1
list = (GEN)factor(pefm1)[1]; nbp=lg(list)-1;
prhall[1]=(long)prh; prhall[2]=zero;
for (n=psim; ; n++)
__________^^^^^^^^^^^^______________________p<2^31-1 may be too large

{
m=n;
for (i=1; i<=N; i++)
g	if (!gcmp1(gcoeff(prh,i,i))) { v[i]=lstoi(m%psim); m/=psim; }
for (j=1; j<=nbp; j++)
{
p1 = divii(pefm1,(GEN)list[j]);
p1 = lift_intern(element_powmodpr(nf,v,p1,prhall));
if (isnfscalar(p1) && gcmp1((GEN)p1[1])) break;
}
if (j>nbp) break;
}

Bill
```

• References: