Check whether polynomial over Galois field is primitive


ck = gfprimck(a)
ck = gfprimck(a,p)


    Note:   This function performs computations in GF(pm), where p is prime. If you are working in GF(2m), use the isprimitive function. For details, see Finding Primitive Polynomials.

ck = gfprimck(a) checks whether the degree-m GF(2) polynomial a is a primitive polynomial for GF(2m), where m = length(a) - 1. The output ck is as follows:

  • -1 if a is not an irreducible polynomial

  • 0 if a is irreducible but not a primitive polynomial for GF(pm)

  • 1 if a is a primitive polynomial for GF(pm)

ck = gfprimck(a,p) checks whether the degree-m GF(P) polynomial a is a primitive polynomial for GF(pm). p is a prime number.

This function considers the zero polynomial to be "not irreducible" and considers all polynomials of degree zero or one to be primitive.


Characterization of Polynomials contains examples.

More About

collapse all


An irreducible polynomial over GF(p) of degree at least 2 is primitive if and only if it does not divide -1 + xk for any positive integer k smaller than pm-1.


[1] Clark, George C. Jr., and J. Bibb Cain, Error-Correction Coding for Digital Communications, New York, Plenum, 1981.

[2] Krogsgaard, K., and T., Karp, Fast Identification of Primitive Polynomials over Galois Fields: Results from a Course Project, ICASSP 2005, Philadelphia, PA, 2004.

Was this topic helpful?