Package: pari
Version: latest from git

This bug is intermittent.  I have had recent problems with other functions, so it may be a memory management issue, or something with variables?

Here is a transcript of a session.  After defining my function (sorry it is long), I run the function several times with the same inputs.  The function is computing quadratic extensions unramified outside a given set.  Anyway, the first few times I run it in the session below, it fails on one congruence subgroup, and then it works.  When it fails, rnfkummer has returned 0.

John Jones



Hobbes ~/gp_progs: gp -f

          GP/PARI CALCULATOR Version 2.8.0 (development 18363-3cbc853)
          amd64 running linux (x86-64/GMP-5.1.3 kernel) 64-bit version
     compiled: Dec 31 2015, gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
                            threading engine: single
                 (readline v6.3 enabled, extended help enabled)

                     Copyright (C) 2000-2015 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes 
WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?15 for how to get moral (and possibly technical) support.

parisize = 8000000, primelimit = 500000
? default(realprecision, 250);
? quads(S, pol) = 
{
  my(maxB, bnf, bnr, sgl, Sset,ipdx, maxe, rnf,np, ans);

  bnf=bnfinit(subst(pol,x,y),1);
  if(bnfcertify(bnf) == 0, return(1/0));
  maxB=1;
  for(k=1,#S,
    ipdx=idealprimedec(bnf, S[k]);
    for(j=1,#ipdx, 
      if(S[k]==2,
        maxe = idealpow(bnf, ipdx[j], 2*ipdx[j][3]+1);
        maxB = idealmul(bnf, maxB, maxe);
      , /* else */
        maxB = idealmul(bnf, maxB, ipdx[j]);
      );
    );
  );
  maxB = [maxB, vector(bnf.r1,h,1)];
  bnr=bnrinit(bnf,maxB,1);
  sgl = subgrouplist(bnr,[2],1);
  ans=[];
  for(k=1,min(#sgl, 20), /* artificially limit how many subgroups it computes with */
    rnf=rnfkummer(bnr,sgl[k]);
print(k);
    np=rnfequation(bnf, rnf);
    ans=concat(ans, np);
  );
  return(Set(ans));
}
? f=x^6 + 5*x^4 + 15*x^2 - 32*x - 5
%3 = x^6 + 5*x^4 + 15*x^2 - 32*x - 5
? quads([2,5],f)
1
2
3
4
5
6
7
  ***   at top-level: quads([2,5],f)
  ***                 ^--------------
  ***   in function quads: ...(bnr,sgl[k]);print(k);np=rnfequation(bnf,rnf)
  ***                                                  ^--------------------
  *** rnfequation: incorrect type in rnfequation [t_POL expected] (t_INT).
  ***   Break loop: type 'break' to go back to GP prompt
break> 

? quads([2,5],f)
1
2
3
4
5
6
7
  ***   at top-level: quads([2,5],f)
  ***                 ^--------------
  ***   in function quads: ...(bnr,sgl[k]);print(k);np=rnfequation(bnf,rnf)
  ***                                                  ^--------------------
  *** rnfequation: incorrect type in rnfequation [t_POL expected] (t_INT).
  ***   Break loop: type 'break' to go back to GP prompt
break> 

? quads([2,5],f)
1
2
3
4
5
6
7
  ***   at top-level: quads([2,5],f)
  ***                 ^--------------
  ***   in function quads: ...(bnr,sgl[k]);print(k);np=rnfequation(bnf,rnf)
  ***                                                  ^--------------------
  *** rnfequation: incorrect type in rnfequation [t_POL expected] (t_INT).
  ***   Break loop: type 'break' to go back to GP prompt
break> 

? quads([2,5],f)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
%4 = [x^12 + 20*x^10 + 275*x^8 + 350*x^6 + 2550*x^4 - 540*x^2 - 200, x^12 - 4280*x^10 - 73025*x^8 - 1266400*x^6 - 1480200*x^4 + 15040*x^2 - 100, x^12 + 310*x^10 - 16950*x^8 - 51750*x^6 - 51025*x^4 - 2040*x^2 - 50, x^12 + 762*x^10 - 4940*x^8 - 164440*x^6 - 657060*x^4 + 6152*x^2 - 16, x^12 - 10*x^10 - 110*x^8 - 70*x^6 - 65*x^4 - 24*x^2 - 10, x^12 + 3*x^10 + 360*x^8 + 1675*x^6 + 2375*x^4 + 30*x^2 - 10, x^12 + 51*x^10 + 1305*x^8 + 9400*x^6 + 575*x^4 + 145*x^2 - 5, x^12 + 3120*x^10 + 32505*x^8 + 48160*x^6 - 366325*x^4 + 2224*x^2 - 5, x^12 + 58*x^10 + 165*x^8 + 460*x^6 + 500*x^4 + 192*x^2 - 4, x^12 + 19*x^10 - 130*x^8 - 315*x^6 - 215*x^4 - 38*x^2 - 2, x^12 + 29*x^10 - 85*x^8 - 70*x^6 + 315*x^4 + 309*x^2 + 1, x^12 + 8*x^10 + 30*x^8 - 20*x^6 + 35*x^4 - 16*x^2 + 2, x^12 - 134*x^10 + 1030*x^8 - 3500*x^6 + 80545*x^4 - 646*x^2 + 4, x^12 + 4*x^10 - 10*x^8 + 75*x^4 + 40*x^2 + 10, x^12 + 25*x^10 + 270*x^8 + 1445*x^6 + 3425*x^4 + 1682*x^2 + 10, x^12 - 18955*x^10 - 25685*x^8 - 228820*x^6 + 2995180*x^4 - 15468*x^2 + 20, x^12 - 27*x^10 + 205*x^8 - 500*x^6 + 600*x^4 - 4460*x^2 + 20, x^12 + 675*x^10 - 20725*x^8 + 237200*x^6 + 177175*x^4 - 4095*x^2 + 25, x^12 - 5*x^10 + 25*x^6 - 25*x^4 - 30*x^2 + 50, x^12 + 210*x^10 + 1875*x^8 - 1300*x^6 + 3050*x^4 - 720*x^2 + 200]