How to construct fields in bnfinit()?

116 views Asked by At

I am new to PARI/GP, learning about different number fields. I am trying to construct the field k = Q(\zeta_23) using bnfinit (23rd cyclotomic field) to run the following script:

v=[]; w=[]; j=0; l=0;
forprime(p=29, 100000, {
    if(p%46==1, j++; if(#bnfisintnorm(k,p)>0,l++;w=[p];v=concat(v,w)))
});
print("Up to 100000 there are ",j," primes congruent to 1 mod 46 and ",l," are norms of principal ideals")

Running into GP gives this error,

<=1,j++;if(#bnfisintnorm(k,p)>0,l++;w=[p];v=concat(v,w))));print("Up to 100000 there are ",j," primes congruent to 1 mod 46 and ",l," are norms of principal ideals")

***   at top-level: ...00000,if(p%46==1,j++;if(#bnfisintnorm(k,p)>0,
***                                             ^--------------------
*** bnfisintnorm: incorrect type in checknf [please apply nfinit()] (t_POL).
(18:29) gp >

This is supposed to find primes p such that there are algebraic integers in field K, with norm p.

Any help please? Thanks.

1

There are 1 answers

0
Piotr Semenov On BEST ANSWER

You can define the number field you want just as k = bnfinit(polcyclo(23)). So your code will output:

gp> Up to 100000 there are 429 primes congruent to 1 mod 46 and 141 are norms of principal ideals

Hope, it helps.