1Function: idealismaximal 2Section: number_fields 3C-Name: idealismaximal 4Prototype: GG 5Help: idealismaximal(nf,x): if x is a maximal ideal, return it in prid form, 6 else return 0. 7Doc: given \var{nf} a number field as output by \kbd{nfinit} and an ideal 8 $x$, return $0$ if $x$ is not a maximal ideal. Otherwise return a \kbd{prid} 9 structure \var{nf} attached to the ideal. This function uses 10 \kbd{ispseudoprime} and may return a wrong result in case the underlying 11 rational pseudoprime is not an actual prime number: apply \kbd{isprime(pr.p)} 12 to guarantee correctness. If $x$ is an extended ideal, the extended part is 13 ignored. 14 \bprog 15 ? K = nfinit(y^2 + 1); 16 ? idealismaximal(K, 3) \\ 3 is inert 17 %2 = [3, [3, 0]~, 1, 2, 1] 18 ? idealismaximal(K, 5) \\ 5 is not 19 %3 = 0 20 ? pr = idealprimedec(K,5)[1] \\ already a prid 21 %4 = [5, [-2, 1]~, 1, 1, [2, -1; 1, 2]] 22 ? idealismaximal(K, pr) \\ trivial check 23 %5 = [5, [-2, 1]~, 1, 1, [2, -1; 1, 2]] 24 ? x = idealhnf(K, pr) 25 %6 = 26 [5 3] 27 28 [0 1] 29 ? idealismaximal(K, x) \\ converts from matrix form to prid 30 %7 = [5, [-2, 1]~, 1, 1, [2, -1; 1, 2]] 31 @eprog\noindent This function is noticeably faster than \kbd{idealfactor} 32 since it never involves an actually factorization, in particular when $x 33 \cap \Z$ is not a prime number. 34