GPRC Done. GP/PARI CALCULATOR Version 2.12.1 (development 25476-78c5f8d2c) i386 running darwin (x86-64/GMP-6.2.0 kernel) 64-bit version compiled: Jun 21 2020, Apple clang version 11.0.0 (clang-1100.0.33.17) threading engine: single (readline v8.0 enabled, extended help enabled) Copyright (C) 2000-2020 The PARI Group PARI/GP is free software, covered by the GNU General Public License, and comes WITHOUT ANY WARRANTY WHATSOEVER. Type ? for help, \q to quit. Type ?17 for how to get moral (and possibly technical) support. parisizemax = 900001792, primelimit = 1000000 (15:18) gp > ? Help topics: for a list of relevant subtopics, type ?n for n in 0: user-defined functions (aliases, installed and user functions) 1: PROGRAMMING under GP 2: Standard monadic or dyadic OPERATORS 3: CONVERSIONS and similar elementary functions 4: functions related to COMBINATORICS 5: NUMBER THEORETICAL functions 6: POLYNOMIALS and power series 7: Vectors, matrices, LINEAR ALGEBRA and sets 8: TRANSCENDENTAL functions 9: SUMS, products, integrals and similar functions 10: General NUMBER FIELDS 11: Associative and central simple ALGEBRAS 12: ELLIPTIC CURVES 13: L-FUNCTIONS 14: MODULAR FORMS 15: MODULAR SYMBOLS 16: GRAPHIC functions 17: The PARI community Also: ? functionname (short on-line help) ?\ (keyboard shortcuts) ?. (member functions) Extended help (if available): ?? (opens the full user's manual in a dvi previewer) ?? tutorial / refcard / libpari (tutorial/reference card/libpari manual) ?? refcard-ell (or -lfun/-mf/-nf: specialized reference card) ?? keyword (long help text about "keyword" from the user's manual) ??? keyword (a propos: list of related functions). (15:18) gp > ?5 addprimes bestappr bestapprPade bezout bigomega charconj chardiv chareval chargalois charker charmul charorder charpow chinese content contfrac contfracpnqn core coredisc dirdiv direuler dirmul divisors divisorslenstra eulerphi factor factorback factorcantor factorff factorial factorint factormod factormodDDF factormodSQF ffcompomap ffembed ffextend fffrobenius ffgen ffinit ffinvmap fflog ffmap ffmaprel ffnbirred fforder ffprimroot gcd gcdext halfgcd hilbert isfundamental ispolygonal ispower ispowerful isprime isprimepower ispseudoprime ispseudoprimepower issquare issquarefree istotient kronecker lcm logint moebius nextprime numdiv omega precprime prime primecert primecertexport primecertisvalid primepi primes qfbclassno qfbcompraw qfbhclassno qfbnucomp qfbnupow qfbpowraw qfbprimeform qfbred qfbredsl2 qfbsolve quadclassunit quaddisc quadgen quadhilbert quadpoly quadray quadregulator quadunit ramanujantau randomprime removeprimes sigma sqrtint sqrtnint sumdedekind sumdigits znchar zncharconductor znchardecompose znchargauss zncharinduce zncharisodd znchartokronecker znchartoprimitive znconreychar znconreyconductor znconreyexp znconreylog zncoppersmith znlog znorder znprimroot znstar (15:18) gp > ?ffextend ffextend(a, P, {v}): extend the field K of definition of a by a root of the polynomial P, assumed to be irreducible over K. Return [r, m] where r is a root of P in the extension field L and m is a map from K to L, see \kbd{ffmap}. If v is given, the variable name is used to display the generator of L, else the name of the variable of P is used. (15:19) gp > ?ffinit ffinit(p,n,{v='x}): monic irreducible polynomial of degree n over F_p[v]. (15:20) gp > ??ffinit ffinit(p,n,{v = 'x}): Computes a monic polynomial of degree n which is irreducible over F_p, where p is assumed to be prime. This function uses a fast variant of Adleman and Lenstra's algorithm. It is useful in conjunction with ffgen; for instance if P = ffinit(3,2), you can represent elements in F_{3^2} in term of g = ffgen(P,'t). This can be abbreviated as g = ffgen(3^2, 't), where the defining polynomial P can be later recovered as g.mod. The library syntax is GEN ffinit(GEN p, long n, long v = -1) where v is a variable number. (15:20) gp > ffinit(2,2) %1 = Mod(1, 2)*x^2 + Mod(1, 2)*x + Mod(1, 2) (15:21) gp > ??ffextend ffextend(a, P, {v}): Extend the field K of definition of a by a root of the polynomial P\in K[X] assumed to be irreducible over K. Return [r, m] where r is a root of P in the extension field L and m is a map from K to L, see ffmap. If v is given, the variable name is used to display the generator of L, else the name of the variable of P is used. A generator of L can be recovered using b = ffgen(r). The image of P in L[X] can be recovered using PL = ffmap(m,P). ? a = ffgen([3,5],'a); ? P = x^2-a; polisirreducible(P) %2 = 1 ? [r,m] = ffextend(a, P, 'b); ? r %3 = b^9+2*b^8+b^7+2*b^6+b^4+1 ? subst(ffmap(m, P), x, r) %4 = 0 ? ffgen(r) %5 = b The library syntax is GEN ffextend(GEN a, GEN P, long v = -1) where v is a variable number. (15:25) gp > ?ffgen ffgen(k,{v = 'x}): return a generator of the finite field k (not necessarily a generator of its multiplicative group) as a t_FFELT. k can be given by its order q, the pair [p,f] with q=p^f, by an irreducible polynomial with t_INTMOD coefficients, or by a finite field element. If v is given, the variable name is used to display g, else the variable of the polynomial or finite field element, or x if only the order was given. (15:28) gp > ??ffgen ffgen(k,{v = 'x}): Return a generator for the finite field k as a t_FFELT. The field k can be given by * its order q * the pair [p,f] where q = p^f * a monic irreducible polynomial with t_INTMOD coefficients modulo a prime. * a t_FFELT belonging to k. If v is given, the variable name is used to display g, else the variable of the polynomial or the t_FFELT is used, else x is used. When only the order is specified, the function uses the polynomial generated by ffinit and is deterministic: two calls to the function with the same parameters will always give the same generator. For efficiency, the characteristic is not checked to be prime; similarly if a polynomial is given, we do not check whether it is irreducible. To obtain a multiplicative generator, call ffprimroot on the result. /*-- (type RETURN to continue) --*/ ? g = ffgen(16, 't); ? g.mod \\ recover the underlying polynomial. %2 = t^4+t^3+t^2+t+1 ? g.pol \\ lift g as a t_POL %3 = t ? g.p \\ recover the characteristic %4 = 2 ? fforder(g) \\ g is not a multiplicative generator %5 = 5 ? a = ffprimroot(g) \\ recover a multiplicative generator %6 = t^3+t^2+t ? fforder(a) %7 = 15 The library syntax is GEN ffgen(GEN k, long v = -1) where v is a variable number. To create a generator for a prime finite field, the function GEN p_to_GEN(GEN p, long v) returns ffgen(p,v)^0. (15:37) gp > ffgen(8) %2 = x (15:43) gp > x.mod *** at top-level: x.mod *** ^--- *** _.mod: incorrect type in mod (t_POL). *** Break loop: type 'break' to go back to GP prompt break> break (15:43) gp > g=ffgen(8) %3 = x (15:43) gp > g.mod %4 = x^3 + x^2 + 1 (15:43) gp > g.p %5 = 2 (15:43) gp > g.orders *** at top-level: g.orders *** ^------ *** _.orders: incorrect type in orders (t_FFELT). *** Break loop: type 'break' to go back to GP prompt break> break (15:43) gp > g.order *** at top-level: g.order *** ^----- *** not a function in function call *** Break loop: type 'break' to go back to GP prompt break> break (15:43) gp > fforder(g) %6 = 7 (15:45) gp > ?ffextend ffextend(a, P, {v}): extend the field K of definition of a by a root of the polynomial P, assumed to be irreducible over K. Return [r, m] where r is a root of P in the extension field L and m is a map from K to L, see \kbd{ffmap}. If v is given, the variable name is used to display the generator of L, else the name of the variable of P is used. (15:45) gp > K=ffgen(9) %7 = x (15:45) gp > K.pol %8 = x (15:45) gp > K.mod %9 = x^2 + x + 2 (15:45) gp > ?ffextend ffextend(a, P, {v}): extend the field K of definition of a by a root of the polynomial P, assumed to be irreducible over K. Return [r, m] where r is a root of P in the extension field L and m is a map from K to L, see \kbd{ffmap}. If v is given, the variable name is used to display the generator of L, else the name of the variable of P is used. (15:46) gp > ffinit(K,3) *** at top-level: ffinit(K,3) *** ^----------- *** ffinit: incorrect type in ffinit (t_FFELT). *** Break loop: type 'break' to go back to GP prompt break> break (15:46) gp > ?ffinit ffinit(p,n,{v='x}): monic irreducible polynomial of degree n over F_p[v]. (15:46) gp > ffextend(K,2) *** at top-level: ffextend(K,2) *** ^------------- *** ffextend: incorrect type in ffextend (t_INT). *** Break loop: type 'break' to go back to GP prompt break> break (15:46) gp > K %10 = x (15:46) gp > ?ffembed ffembed(a, b): given two elements a and b in finite fields, return a map embedding the definition field of a to the definition field of b. (15:47) gp > ?ffmap ffmap(m, x): given a (partial) map m between two finite fields, return the image of x by m. The function is applied recursively to the component of vectors, matrices and polynomials. If m is a partial map that is not defined at x, return [] (15:47) gp > ?ffinit ffinit(p,n,{v='x}): monic irreducible polynomial of degree n over F_p[v]. (15:47) gp > ffinit(3,4) %11 = Mod(1, 3)*x^4 + Mod(1, 3)*x^3 + Mod(1, 3)*x^2 + Mod(1, 3)*x + Mod(1, 3) (15:47) gp > ffembed(K,ffinit(3,4)) *** at top-level: ffembed(K,ffinit(3,4)) *** ^---------------------- *** ffembed: incorrect type in ffembed (t_POL). *** Break loop: type 'break' to go back to GP prompt break> break (15:48) gp > ?ffembed ffembed(a, b): given two elements a and b in finite fields, return a map embedding the definition field of a to the definition field of b. (15:48) gp > ffembed(K,ffgen(ffinit(3,4))) %12 = [x, x^3 + x^2] (15:48) gp > ffgen(ffinit(3,4)) %13 = x (15:48) gp > ffgen(ffinit(3,4)).pol %14 = x (15:48) gp > ffgen(ffinit(3,4)).mod %15 = x^4 + x^3 + x^2 + x + 1 (15:48) gp > K.mod %16 = x^2 + x + 2 (15:49) gp > ffgen(ffinit(3,4),y).mod %17 = y^4 + y^3 + y^2 + y + 1 (15:49) gp > ffembed(K,ffgen(ffinit(3,4),y)) %18 = [x, y^3 + y^2] (15:49) gp > Y=ffgen(ffinit(3,4),y).mod %19 = y^4 + y^3 + y^2 + y + 1 (15:51) gp > Y=ffgen(ffinit(3,4),y) %20 = y (15:51) gp > Z=Y^2+Y^3 %21 = y^3 + y^2 (15:52) gp > 2+Z %22 = y^3 + y^2 + 2 (15:52) gp > 2+Z+Z^2 %23 = 0 (15:52) gp > ?ffextend ffextend(a, P, {v}): extend the field K of definition of a by a root of the polynomial P, assumed to be irreducible over K. Return [r, m] where r is a root of P in the extension field L and m is a map from K to L, see \kbd{ffmap}. If v is given, the variable name is used to display the generator of L, else the name of the variable of P is used. (15:53) gp > ?ffextend ffextend(a, P, {v}): extend the field K of definition of a by a root of the polynomial P, assumed to be irreducible over K. Return [r, m] where r is a root of P in the extension field L and m is a map from K to L, see \kbd{ffmap}. If v is given, the variable name is used to display the generator of L, else the name of the variable of P is used. (15:54) gp > K %24 = x (15:54) gp > K.mod %25 = x^2 + x + 2 (15:54) gp > X=K %26 = x (15:55) gp > factor(t^2+1) %27 = [t^2 + 1 1] (15:55) gp > factor(t^2+X) %28 = [t^2 + x 1] (15:55) gp > factor(t^2+2*X) %29 = [t^2 + 2*x 1] (15:55) gp > factor(t^2+3*X) %30 = [t 2] (15:55) gp > factor(t^2+X+1) %31 = [t^2 + (x + 1) 1] (15:55) gp > factor(t^2-X+1) %32 = [ t + (x + 1) 1] [t + (2*x + 2) 1] (15:55) gp > ?factor factor(x,{D}): factorization of x over domain D. If x and D are both integers, return partial factorization, using primes < D. (15:56) gp > ??factor factor(x,{D}): Factor x over domain D; if D is omitted, it is determined from x. For instance, if x is an integer, it is factored in Z, if it is a polynomial with rational coefficients, it is factored in Q[x], etc., see below for details. The result is a two-column matrix: the first contains the irreducibles dividing x (rational or Gaussian primes, irreducible polynomials), and the second the exponents. By convention, 0 is factored as 0^1. x \in Q. See factorint for the algorithms used. The factorization includes the unit -1 when x < 0 and all other factors are positive; a denominator is factored with negative exponents. The factors are sorted in increasing order. ? factor(-7/106) %1 = [-1 1] [ 2 -1] [ 7 1] [53 -1] By convention, 1 is factored as matrix(0,2) (the empty factorization, printed as [;]). /*-- (type RETURN to continue) --*/ Large rational "primes" > 2^{64} in the factorization are in fact pseudoprimes (see ispseudoprime), a priori not rigorously proven primes. Use isprime to prove primality of these factors, as in ? fa = factor(2^2^7 + 1) %2 = [59649589127497217 1] [5704689200685129054721 1] ? isprime( fa[,1] ) %3 = [1, 1]~ \\ both entries are proven primes Another possibility is to globally set the default factor_proven, which will perform a rigorous primality proof for each pseudoprime factor but will slow down PARI. A t_INT argument D can be added, meaning that we look only for prime factors p < D. The limit D must be non-negative. In this case, all but the last factor are proven primes, but the remaining factor may actually be a proven composite! If the remaining factor is less than D^2, then it is prime. ? factor(2^2^7 +1, 10^5) %4 = [340282366920938463463374607431768211457 1] /*-- (type RETURN to continue) --*/ Deprecated feature. Setting D = 0 is the same as setting it to primelimit + 1. This routine uses trial division and perfect power tests, and should not be used for huge values of D (at most 10^9, say): factorint(, 1 + 8) will in general be faster. The latter does not guarantee that all small prime factors are found, but it also finds larger factors and in a more efficient way. ? F = (2^2^7 + 1) * 1009 * (10^5+3); factor(F, 10^5) \\ fast, incomplete time = 0 ms. %5 = [1009 1] [34029257539194609161727850866999116450334371 1] ? factor(F, 10^9) \\ slow time = 3,260 ms. %6 = [1009 1] [100003 1] [340282366920938463463374607431768211457 1] /*-- (type RETURN to continue) --*/ ? factorint(F, 1+8) \\ much faster and all small primes were found time = 8 ms. %7 = [1009 1] [100003 1] [340282366920938463463374607431768211457 1] ? factor(F) \\ complete factorization time = 60 ms. %8 = [1009 1] [100003 1] [59649589127497217 1] [5704689200685129054721 1] Setting D = I will factor in the Gaussian integers Z[i]: x \in Q(i). The factorization is performed with Gaussian primes in Z[i] and includes Gaussian units in {+/-1, +/- i}; factors are sorted by increasing norm. Except for a /*-- (type RETURN to continue) --*/ possible leading unit, the Gaussian factors are normalized: rational factors are positive and irrational factors have positive imaginary part (a canonical represneta. Unless factor_proven is set, large factors are actually pseudoprimes, not proven primes; a rational factor is prime if less than 2^{64} and an irrational one if its norm is less than 2^{64}. ? factor(5*I) %9 = [ 2 + I 1] [1 + 2*I 1] One can force the factorization of a rational number by setting the domain D = I: ? factor(-5, I) %10 = [ I 1] [ 2 + I 1] [1 + 2*I 1] ? factorback(%) %11 = -5 /*-- (type RETURN to continue) --*/ Univariate polynomials and rational functions. PARI can factor univariate polynomials in K[t]. The following base fields K are currently supported: Q, R, C, Q_p, finite fields and number fields. See factormod and factorff for the algorithms used over finite fields and nffactor for the algorithms over number fields. The irreducible factors are sorted by increasing degree and normalized: they are monic except when K = Q where they are primitive in Z[t]. The content is not included in the factorization, in particular factorback will in general recover the original x only up to multiplication by an element of K^*: when K != Q, this scalar is pollead(x) (since irreducible factors are monic); and when K = Q you can either ask for the Q-content explicitly of use factorback: ? P = t^2 + 5*t/2 + 1; F = factor(P) %12 = [t + 2 1] [2*t + 1 1] ? content(P, 1) \\ Q-content %13 = 1/2 ? pollead(factorback(F)) / pollead(P) %14 = 2 /*-- (type RETURN to continue) --*/ You can specify K using the optional "domain" argument D as follows * K = Q : D a rational number (t_INT or t_FRAC), * K = Z/pZ with p prime : D a t_INTMOD modulo p; factoring modulo a non-prime number is not supported. * K = F_q : D a t_FFELT encoding the finite field; you can also use a t_POLMOD of t_INTMOD modulo a prime p but this is usualy less convenient; * K = Q[X]/(T) a number field : D a t_POLMOD modulo T, * K = Q(i) (alternate syntax for special case): D = I, * K = Q(w) a quadratic number field (alternate syntax for special case): D a t_QUAD, * K = R : D a real number (t_REAL); truncate the factorization at accuracy precision(D). If x is inexact and precision(x) is less than precision(D), then the precision of x is used instead. * K = C : D a complex number with a t_REAL component, e.g. I * 1.; truncate the factorization as for K = R, /*-- (type RETURN to continue) --*/ * K = Q_p : D a t_PADIC; truncate the factorization at p-adic accuracy padicprec(D), possibly less if x is inexact with insufficient p-adic accuracy; ? T = x^2+1; ? factor(T, 1); \\ over Q ? factor(T, Mod(1,3)) \\ over F_3 ? factor(T, ffgen(ffinit(3,2,'t))^0) \\ over F_{3^2} ? factor(T, Mod(Mod(1,3), t^2+t+2)) \\ over F_{3^2}, again ? factor(T, O(3^6)) \\ over Q_3, precision 6 ? factor(T, 1.) \\ over R, current precision ? factor(T, I*1.) \\ over C ? factor(T, Mod(1, y^3-2)) \\ over Q(2^{1/3}) In most cases, it is possible and simpler to call a specialized variant rather than use the above scheme: ? factormod(T, 3) \\ over F_3 ? factormod(T, [t^2+t+2, 3]) \\ over F_{3^2} ? factormod(T, ffgen(3^2, 't)) \\ over F_{3^2} ? factorpadic(T, 3,6) \\ over Q_3, precision 6 ? nffactor(y^3-2, T) \\ over Q(2^{1/3}) ? polroots(T) \\ over C ? polrootsreal(T) \\ over R (real polynomial) /*-- (type RETURN to continue) --*/ It is also possible to let the routine use the smallest field containing all coefficients, taking into account quotient structures induced by t_INTMODs and t_POLMODs (e.g. if a coefficient in Z/nZ is known, all rational numbers encountered are first mapped to Z/nZ; different moduli will produce an error): ? T = x^2+1; ? factor(T); \\ over Q ? factor(T*Mod(1,3)) \\ over F_3 ? factor(T*ffgen(ffinit(3,2,'t))^0) \\ over F_{3^2} ? factor(T*Mod(Mod(1,3), t^2+t+2)) \\ over F_{3^2}, again ? factor(T*(1 + O(3^6)) \\ over Q_3, precision 6 ? factor(T*1.) \\ over R, current precision ? factor(T*(1.+0.*I)) \\ over C ? factor(T*Mod(1, y^3-2)) \\ over Q(2^{1/3}) Multiplying by a suitable field element equal to 1 \in K in this way is error-prone and is not recommanded. Factoring existing polynomials with obvious fields of coefficients is fine, the domain argument D should be used instead ad hoc conversions. Note on inexact polynomials. Polynomials with inexact coefficients (e.g. floating point or p-adic numbers) are first rounded to an exact representation, then factored to (potentially) infinite accuracy and we return a truncated approximation of that virtual factorization. To avoid pitfalls, we advise to only factor exact polynomials: /*-- (type RETURN to continue) --*/ ? factor(x^2-1+O(2^2)) \\ rounded to x^2 + 3, irreducible in Q_2 %1 = [(1 + O(2^2))*x^2 + O(2^2)*x + (1 + 2 + O(2^2)) 1] ? factor(x^2-1+O(2^3)) \\ rounded to x^2 + 7, reducible ! %2 = [ (1 + O(2^3))*x + (1 + 2 + O(2^3)) 1] [(1 + O(2^3))*x + (1 + 2^2 + O(2^3)) 1] ? factor(x^2-1, O(2^2)) \\ no ambiguity now %3 = [ (1 + O(2^2))*x + (1 + O(2^2)) 1] [(1 + O(2^2))*x + (1 + 2 + O(2^2)) 1] Note about inseparable polynomials. Polynomials with inexact coefficients are considered to be squarefree: indeed, there exist a squarefree polynomial arbitrarily close to the input, and they cannot be distinguished at the input accuracy. This means that irreducible factors are repeated according to their apparent multiplicity. On the contrary, using a specialized function such as factorpadic with an exact rational input yields the correct multiplicity when the (now exact) input is not separable. Compare: ? factor(z^2 + O(5^2))) /*-- (type RETURN to continue) --*/ %1 = [(1 + O(5^2))*z + O(5^2) 1] [(1 + O(5^2))*z + O(5^2) 1] ? factor(z^2, O(5^2)) %2 = [1 + O(5^2))*z + O(5^2) 2] Multivariate polynomials and rational functions. PARI recursively factors multivariate polynomials in K[t_1,..., t_d] for the same fields K as above and the argument D is used in the same way to specify K. The irreducible factors are sorted by their main variable (least priority first) then by increasing degree. ? factor(x^2 + y^2, Mod(1,5)) %1 = [ x + Mod(2, 5)*y 1] [Mod(1, 5)*x + Mod(3, 5)*y 1] ? factor(x^2 + y^2, O(5^2)) %2 = [ (1 + O(5^2))*x + (O(5^2)*y^2 + (2 + 5 + O(5^2))*y + O(5^2)) 1] [(1 + O(5^2))*x + (O(5^2)*y^2 + (3 + 3*5 + O(5^2))*y + O(5^2)) 1] /*-- (type RETURN to continue) --*/ ? lift(%) %3 = [ x + 7*y 1] [x + 18*y 1] Note that the implementation does not really support inexact real fields (R or C) and usually misses factors even if the input is exact: ? factor(x^2 + y^2, I) \\ over Q(i) %4 = [x - I*y 1] [x + I*y 1] ? factor(x^2 + y^2, I*1.) \\ over C %5 = [x^2 + y^2 1] The library syntax is GEN factor0(GEN x, GEN D = NULL). GEN factor(GEN x) GEN boundfact(GEN x, ulong lim). (16:10) gp > Y %33 = y (16:10) gp > Y.mod %34 = y^4 + y^3 + y^2 + y + 1 (16:10) gp > X.mod %35 = x^2 + x + 2 (16:10) gp > factor(z^2+1,K) %36 = [ z + (x + 2) 1] [z + (2*x + 1) 1] (16:10) gp > factor(z^2+1) %37 = [z^2 + 1 1] (16:10) gp > factor(z^2+1,K) %38 = [ z + (x + 2) 1] [z + (2*x + 1) 1] (16:10) gp > K.mod %39 = x^2 + x + 2 (16:11) gp > K.pol %40 = x (16:11) gp > factor(z^3+1,K) %41 = [z + 1 3] (16:11) gp > factor(z^4+1,K) %42 = [ z + x 1] [ z + (x + 1) 1] [ z + 2*x 1] [z + (2*x + 2) 1] (16:11) gp > factor(z^4+z^3+z^2+z+1,K) %43 = [z^2 + (x + 1)*z + 1 1] [ z^2 + 2*x*z + 1 1] (16:11) gp > Y %44 = y (16:11) gp > Y.mod %45 = y^4 + y^3 + y^2 + y + 1 (16:12) gp > factor(Y.mod,K) %46 = [y^2 + (x + 1)*y + 1 1] [ y^2 + 2*x*y + 1 1] (16:12) gp > ?ffextend ffextend(a, P, {v}): extend the field K of definition of a by a root of the polynomial P, assumed to be irreducible over K. Return [r, m] where r is a root of P in the extension field L and m is a map from K to L, see \kbd{ffmap}. If v is given, the variable name is used to display the generator of L, else the name of the variable of P is used. (16:13) gp > ffextend(K,y^2+2*x*y+1) *** at top-level: ffextend(K,y^2+2*x*y+1) *** ^----------------------- *** ffextend: incorrect type in Rg_to_raw (t_POL). *** Break loop: type 'break' to go back to GP prompt break> break (16:13) gp > ffextend(K,y^2+2*K*y+1) %47 = [y^2, [x, y^3 + y^2]] (16:13) gp > G(p,n)=factormod(x^(p^n)-x,p) %48 = (p,n)->factormod(x^(p^n)-x,p) (16:53) gp > ?factormod factormod(f,{D},{flag=0}): factors the polynomial f over the finite field defined by the domain D; flag is optional, and can be 0: default or 1: only the degrees of the irreducible factors are given. (16:53) gp > G(2,2) %49 = [ Mod(1, 2)*x 1] [ Mod(1, 2)*x + Mod(1, 2) 1] [Mod(1, 2)*x^2 + Mod(1, 2)*x + Mod(1, 2) 1] (16:54) gp > lift(%) %50 = [ x 1] [ x + 1 1] [x^2 + x + 1 1] (16:54) gp > G(p,n)=[p,lift(factormod(x^(p^n)-x,p))] %51 = (p,n)->[p,lift(factormod(x^(p^n)-x,p))] (16:54) gp > G(2,2) %52 = [2, [x, 1; x + 1, 1; x^2 + x + 1, 1]] (16:54) gp > G(2,3) %53 = [2, [x, 1; x + 1, 1; x^3 + x + 1, 1; x^3 + x^2 + 1, 1]] (16:54) gp > G(2,4) %54 = [2, [x, 1; x + 1, 1; x^2 + x + 1, 1; x^4 + x + 1, 1; x^4 + x^3 + 1, 1; x^4 + x^3 + x^2 + x + 1, 1]] (16:54) gp > G(2,5) %55 = [2, [x, 1; x + 1, 1; x^5 + x^2 + 1, 1; x^5 + x^3 + 1, 1; x^5 + x^3 + x^2 + x + 1, 1; x^5 + x^4 + x^2 + x + 1, 1; x^5 + x^4 + x^3 + x + 1, 1; x^5 + x^4 + x^3 + x^2 + 1, 1]] (16:55) gp > G(2,6) %56 = [2, [x, 1; x + 1, 1; x^2 + x + 1, 1; x^3 + x + 1, 1; x^3 + x^2 + 1, 1; x^6 + x + 1, 1; x^6 + x^3 + 1, 1; x^6 + x^4 + x^2 + x + 1, 1; x^6 + x^4 + x^3 + x + 1, 1; x^6 + x^5 + 1, 1; x^6 + x^5 + x^2 + x + 1, 1; x^6 + x^5 + x^3 + x^2 + 1, 1; x^6 + x^5 + x^4 + x + 1, 1; x^6 + x^5 + x^4 + x^2 + 1, 1]] (16:55) gp > G(3,5) %57 = [3, [x, 1; x + 1, 1; x + 2, 1; x^5 + 2*x + 1, 1; x^5 + 2*x + 2, 1; x^5 + x^2 + x + 2, 1; x^5 + 2*x^2 + x + 1, 1; x^5 + x^3 + x + 1, 1; x^5 + x^3 + x + 2, 1; x^5 + x^3 + x^2 + 2, 1; x^5 + x^3 + x^2 + 2*x + 2, 1; x^5 + x^3 + 2*x^2 + 1, 1; x^5 + x^3 + 2*x^2 + 2*x + 1, 1; x^5 + 2*x^3 + x^2 + 1, 1; x^5 + 2*x^3 + x^2 + x + 2, 1; x^5 + 2*x^3 + x^2 + 2*x + 2, 1; x^5 + 2*x^3 + 2*x^2 + 2, 1; x^5 + 2*x^3 + 2*x^2 + x + 1, 1; x^5 + 2*x^3 + 2*x^2 + 2*x + 1, 1; x^5 + x^4 + 2, 1; x^5 + x^4 + x + 2, 1; x^5 + x^4 + 2*x + 1, 1; x^5 + x^4 + x^2 + 1, 1; x^5 + x^4 + x^2 + x + 1, 1; x^5 + x^4 + x^2 + 2*x + 2, 1; x^5 + x^4 + x^3 + x + 1, 1; x^5 + x^4 + x^3 + x^2 + 2*x + 1, 1; x^5 + x^4 + x^3 + 2*x^2 + x + 1, 1; x^5 + x^4 + x^3 + 2*x^2 + x + 2, 1; x^5 + x^4 + 2*x^3 + 1, 1; x^5 + x^4 + 2*x^3 + 2*x + 2, 1; x^5 + x^4 + 2*x^3 + x^2 + 2, 1; x^5 + x^4 + 2*x^3 + x^2 + x + 1, 1; x^5 + x^4 + 2*x^3 + 2*x^2 + 1, 1; x^5 + x^4 + 2*x^3 + 2*x^2 + 2, 1; x^5 + 2*x^4 + 1, 1; x^5 + 2*x^4 + x + 1, 1; x^5 + 2*x^4 + 2*x + 2, 1; x^5 + 2*x^4 + 2*x^2 + 2, 1; x^5 + 2*x^4 + 2*x^2 + x + 2, 1; x^5 + 2*x^4 + 2*x^2 + 2*x + 1, 1; x^5 + 2*x^4 + x^3 + x + 2, 1; x^5 + 2*x^4 + x^3 + x^2 + x + 1, 1; x^5 + 2*x^4 + x^3 + x^2 + x + 2, 1; x^5 + 2*x^4 + x^3 + 2*x^2 + 2*x + 2, 1; x^5 + 2*x^4 + 2*x^3 + 2, 1; x^5 + 2*x^4 + 2*x^3 + 2*x + 1, 1; x^5 + 2*x^4 + 2*x^3 + x^2 + 1, 1; x^5 + 2*x^4 + 2*x^3 + x^2 + 2, 1; x^5 + 2*x^4 + 2*x^3 + 2*x^2 + 1, 1; x^5 + 2*x^4 + 2*x^3 + 2*x^2 + x + 2, 1]] (16:57) gp > H(p,n)=[p,L=lift(factormod(x^(p^n)-x,p));vector(#L,k,poldegree(L[k,1]))] *** matrix must be rectangular: ...(factormod(x^(p^n)-x,p));vector(#L,k,poldegree *** ^--------------------- (16:58) gp > H(p,n)=[p,L=lift(factormod(x^(p^n)-x,p));vector(#L,k,poldegree(L[k,1])))] *** syntax error, unexpected ')', expecting ';' or ']': ...(#L,k,poldegree(L[k,1])))] *** ^- (16:58) gp > H(p,n)=[p,L=lift(factormod(x^(p^n)-x,p)));vector(#L,k,poldegree(L[k,1]))] *** syntax error, unexpected ')', expecting ',': ...ctor(#L,k,poldegree(L[k,1]))] *** ^---- (16:58) gp > H(p,n)=[p,L=lift(factormod(x^(p^n)-x,p)));vector(#L,k,poldegree(L[k,1])] *** syntax error, unexpected ')', expecting ',': ...ctor(#L,k,poldegree(L[k,1])] *** ^--- (16:58) gp > H(p,n)=[p,L=lift(factormod(x^(p^n)-x,p)));vector(#L,k,poldegree(L[k,1])] *** syntax error, unexpected ')', expecting ',': ...ctor(#L,k,poldegree(L[k,1])] *** ^--- (16:58) gp > G(7,3) %58 = [7, [x, 1; x + 1, 1; x + 2, 1; x + 3, 1; x + 4, 1; x + 5, 1; x + 6, 1; x^3 + 2, 1; x^3 + 3, 1; x^3 + 4, 1; x^3 + 5, 1; x^3 + x + 1, 1; x^3 + x + 6, 1; x^3 + 2*x + 1, 1; x^3 + 2*x + 6, 1; x^3 + 3*x + 2, 1; x^3 + 3*x + 5, 1; x^3 + 4*x + 1, 1; x^3 + 4*x + 6, 1; x^3 + 5*x + 2, 1; x^3 + 5*x + 5, 1; x^3 + 6*x + 2, 1; x^3 + 6*x + 5, 1; x^3 + x^2 + 1, 1; x^3 + x^2 + 3, 1; x^3 + x^2 + x + 2, 1; x^3 + x^2 + x + 5, 1; x^3 + x^2 + 2*x + 4, 1; x^3 + x^2 + 2*x + 6, 1; x^3 + x^2 + 3*x + 1, 1; x^3 + x^2 + 3*x + 5, 1; x^3 + x^2 + 4*x + 3, 1; x^3 + x^2 + 4*x + 6, 1; x^3 + x^2 + 5*x + 1, 1; x^3 + x^2 + 5*x + 2, 1; x^3 + x^2 + 5*x + 3, 1; x^3 + x^2 + 5*x + 4, 1; x^3 + x^2 + 6*x + 3, 1; x^3 + x^2 + 6*x + 5, 1; x^3 + 2*x^2 + 1, 1; x^3 + 2*x^2 + 3, 1; x^3 + 2*x^2 + x + 4, 1; x^3 + 2*x^2 + x + 6, 1; x^3 + 2*x^2 + 2*x + 3, 1; x^3 + 2*x^2 + 2*x + 6, 1; x^3 + 2*x^2 + 3*x + 3, 1; x^3 + 2*x^2 + 3*x + 5, 1; x^3 + 2*x^2 + 4*x + 2, 1; x^3 + 2*x^2 + 4*x + 5, 1; x^3 + 2*x^2 + 5*x + 1, 1; x^3 + 2*x^2 + 5*x + 5, 1; x^3 + 2*x^2 + 6*x + 1, 1; x^3 + 2*x^2 + 6*x + 2, 1; x^3 + 2*x^2 + 6*x + 3, 1; x^3 + 2*x^2 + 6*x + 4, 1; x^3 + 3*x^2 + 4, 1; x^3 + 3*x^2 + 6, 1; x^3 + 3*x^2 + x + 1, 1; x^3 + 3*x^2 + x + 4, 1; x^3 + 3*x^2 + 2*x + 2, 1; x^3 + 3*x^2 + 2*x + 5, 1; x^3 + 3*x^2 + 3*x + 3, 1; x^3 + 3*x^2 + 3*x + 4, 1; x^3 + 3*x^2 + 3*x + 5, 1; x^3 + 3*x^2 + 3*x + 6, 1; x^3 + 3*x^2 + 4*x + 1, 1; x^3 + 3*x^2 + 4*x + 3, 1; x^3 + 3*x^2 + 5*x + 2, 1; x^3 + 3*x^2 + 5*x + 4, 1; x^3 + 3*x^2 + 6*x + 2, 1; x^3 + 3*x^2 + 6*x + 6, 1; x^3 + 4*x^2 + 1, 1; x^3 + 4*x^2 + 3, 1; x^3 + 4*x^2 + x + 3, 1; x^3 + 4*x^2 + x + 6, 1; x^3 + 4*x^2 + 2*x + 2, 1; x^3 + 4*x^2 + 2*x + 5, 1; x^3 + 4*x^2 + 3*x + 1, 1; x^3 + 4*x^2 + 3*x + 2, 1; x^3 + 4*x^2 + 3*x + 3, 1; x^3 + 4*x^2 + 3*x + 4, 1; x^3 + 4*x^2 + 4*x + 4, 1; x^3 + 4*x^2 + 4*x + 6, 1; x^3 + 4*x^2 + 5*x + 3, 1; x^3 + 4*x^2 + 5*x + 5, 1; x^3 + 4*x^2 + 6*x + 1, 1; x^3 + 4*x^2 + 6*x + 5, 1; x^3 + 5*x^2 + 4, 1; x^3 + 5*x^2 + 6, 1; x^3 + 5*x^2 + x + 1, 1; x^3 + 5*x^2 + x + 3, 1; x^3 + 5*x^2 + 2*x + 1, 1; x^3 + 5*x^2 + 2*x + 4, 1; x^3 + 5*x^2 + 3*x + 2, 1; x^3 + 5*x^2 + 3*x + 4, 1; x^3 + 5*x^2 + 4*x + 2, 1; x^3 + 5*x^2 + 4*x + 5, 1; x^3 + 5*x^2 + 5*x + 2, 1; x^3 + 5*x^2 + 5*x + 6, 1; x^3 + 5*x^2 + 6*x + 3, 1; x^3 + 5*x^2 + 6*x + 4, 1; x^3 + 5*x^2 + 6*x + 5, 1; x^3 + 5*x^2 + 6*x + 6, 1; x^3 + 6*x^2 + 4, 1; x^3 + 6*x^2 + 6, 1; x^3 + 6*x^2 + x + 2, 1; x^3 + 6*x^2 + x + 5, 1; x^3 + 6*x^2 + 2*x + 1, 1; x^3 + 6*x^2 + 2*x + 3, 1; x^3 + 6*x^2 + 3*x + 2, 1; x^3 + 6*x^2 + 3*x + 6, 1; x^3 + 6*x^2 + 4*x + 1, 1; x^3 + 6*x^2 + 4*x + 4, 1; x^3 + 6*x^2 + 5*x + 3, 1; x^3 + 6*x^2 + 5*x + 4, 1; x^3 + 6*x^2 + 5*x + 5, 1; x^3 + 6*x^2 + 5*x + 6, 1; x^3 + 6*x^2 + 6*x + 2, 1; x^3 + 6*x^2 + 6*x + 4, 1]] (16:58) gp > lift(factormod(z^(7^3)-z,7)) %59 = [ z 1] [ z + 1 1] [ z + 2 1] [ z + 3 1] [ z + 4 1] [ z + 5 1] [ z + 6 1] [ z^3 + 2 1] [ z^3 + 3 1] [ z^3 + 4 1] [ z^3 + 5 1] [ z^3 + z + 1 1] [ z^3 + z + 6 1] [ z^3 + 2*z + 1 1] [ z^3 + 2*z + 6 1] [ z^3 + 3*z + 2 1] [ z^3 + 3*z + 5 1] [ z^3 + 4*z + 1 1] [ z^3 + 4*z + 6 1] [ z^3 + 5*z + 2 1][+++]