do(i)=
{ my(t = bnfisintnorm(bnf,i));
  for (k=1,#t, if (nfeltnorm(bnf,t[k])!=i, error([i,k])));
  if (#t, print(i,":",#t));
}
\e
setrand(1); bnf=bnfinit(x^2+105);
for(i=1,1000, do(i))
setrand(1); bnf=bnfinit(x^2-65);
for(i=1,1000, do(i-500))
setrand(1); bnf=bnfinit(x^5-37);
for(i=1,1000, do(i-500))
/* regression tests: */
bnfisintnorm(bnfinit(x^3+5), 5)
bnfisintnorm(bnfinit('y^2+93),54647)

bnf = bnfinit('y^2-1466,1);
bnfisintnorm(bnf, 10, 1)
bnfisintnorm(bnf, -10, 1)

bnf = bnfinit('y^2-100129,1);
bnfisintnorm(bnf,-6,1)

bnf = bnfinit('x^2-2305843005992468481,1);
v=bnfisintnorm(bnf,2305843008139952128,1);
#v

