Loïc Grenié on Thu, 18 Dec 2014 14:40:31 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Factoring in unique factorization domains


2014-12-18 13:50 GMT+01:00 Andrew Lelechenko <andnrew.lelechenko@gmail.com>:
> What is the best way to factor integers in quadratic rings, which are unique
> factorization domains, using PARI/GP? Should I use idealfactor() with
> nfinit()?

    Yes and you need to then use bnfisprincipal after a bnfinit:

? K=bnfinit(x^2-101);
? fac=idealfactor(K,65)
%2 =
[    [5, [5, 2]~, 1, 1, [2, 50; 2, 0]] 1]

[   [5, [7, 2]~, 1, 1, [0, 50; 2, -2]] 1]

[[13, [-5, 2]~, 1, 1, [-6, 50; 2, -8]] 1]

[ [13, [7, 2]~, 1, 1, [-5, 50; 2, -7]] 1]

? bnfisprincipal(K,fac[1,1])[2]
%3 = [-5, -1]~
? bnfisprincipal(K,fac[2,1])[2]
%4 = [4, -1]~
? bnfisprincipal(K,fac[3,1])[2]
%5 = [4, 1]~
? bnfisprincipal(K,fac[4,1])[2]
%6 = [-3, 1]~
? nfeltmul(K,nfeltmul(K,%3,%4),nfeltmul(K,%5,%6))/65
%7 = [1, 0]~

    Obviously the last one is a unit, not necessarily 1...

       Hope this helps,

             Loïc