github.com/advanderveer/restic@v0.8.1-0.20171209104529-42a8c19aaea6/doc/test_irreducibility.gap (about) 1 # This file is a script for GAP and tests a list of polynomials in hexadecimal 2 # for irreducibility over F_2 3 4 # create x over F_2 = GF(2) 5 x := Indeterminate(GF(2), "x"); 6 7 # test if polynomial is irreducible, i.e. the number of factors is one 8 IrredPoly := function (poly) 9 return (Length(Factors(poly)) = 1); 10 end;; 11 12 # create a polynomial in x from the hexadecimal representation of the 13 # coefficients 14 Hex2Poly := function (s) 15 return ValuePol(CoefficientsQadic(IntHexString(s), 2), x); 16 end;; 17 18 # list of candidates, in hex 19 candidates := [ "3DA3358B4DC173" ]; 20 21 # create real polynomials 22 L := List(candidates, Hex2Poly); 23 24 # filter and display the list of irreducible polynomials contained in L 25 Display(Filtered(L, x -> (IrredPoly(x))));