I am testing Prime polynomials in $GF(2)$ and have noticed a pattern that I hope will help.

There's a calculator here if you want to familiarise yourself with polynomials over $GF(2)$.

I am testing for primitivity and am therefore, given a polynomial of degree $d$, testing to see if it divides any polynomial $2^n + 1$ for $n$ from $1$ to $2^p-1$.

For example, given the prime polynomial $x^6 + x^3 + 1$ I can see that $(x^9 + 1)/(x^6 + x^3 + 1) = (x^3 + 1)$ so it is therefore not primitive because $9$ is less than $2^6 - 1 = 63$.

There seems to be a significant pattern emerging. Most of the dividends are similar for any specific degree of polynomial. For example, out of the $99$ degree $10$ prime polynomials $60$ are primitive and $39$ are divisors of a polynomial of the above form. But here's the strange thing, the dividends consist of just $(2^{33} + 1)$ $(2^{93} + 1)$ and $(2^{341} + 1)$. Just those threeare dividends to $39$ degree $10$ polynomials between them - and their degrees are all factors, or multiples of the factors of $1023 = 2^{10} - 1$ which are $3,11,31,33,93,341$. Coincidence? Degree = 10! Factors of $1023$ has close relationship to powers of the dividends?

Here's the pattern for each of the degrees $d$ I have tested so far:

$$\begin{array}{|r|r|l|l|} \hline \text{$d$} & \text{$2^d - 1$} & \text{Factors of $2^d - 1$} & \text{Degrees of $x^n + 1$ as a dividend}\\ \hline 4 & 15 & 3, 5 & 5 \\ \hline 5 & 31 & - & - \\ \hline 6 & 63 & 3, 3, 7 & 9, 21 \\ \hline 7 & 127 & - & - \\ \hline 8 & 255 & 3, 5, 7 & 51, 85 \\ \hline 9 & 511 & 7, 73 & 73 \\ \hline 10 & 1023 & 3, 11, 31 & 33, 93, 341 \\ \hline 11 & 2047 & 23, 89 & 23, 89 \\ \hline 12 & 4095 & 3, 3, 5, 7, 13 & 45, 195, 315, 455, 585, 1365, 1638 \\ \hline 13 & 8191 & - & \\ \hline 14 & 16383 & 3, 43, 127 & 129, 381, 5461 \\ \hline \end{array}$$

So - any ideas on how I could come up with a list of all possible dividends so I don't have to trawl through $2^d - 1$ of them - which gets seriously tiring as the degree rises.


  1. I stop when I find the first dividend that can be divided by the polynomial - so there may be more tham I list.
  2. I use a ForkJoinPool to do my factoring so it is possible that occasionally I am not finding the lowest degree dividend but I think that is likely to be rare.


I think I've found a further pattern I would like some feedback on - not sure if this should be another question or not. I would welcome feedback.

I decided to print out the totient of each dividend I was using to test for primitivity and see if the count of how many times this dividend was used to distinguish primality from primitivity was related.

The relationship is unmistakeable. It looks very much like the number of polynomials each dividend is divided by is equal to the totient of the degree of the dividend divided by the degree of the polynomial.

For example - with our degree 10 polynomials, for each dividend there are the following number of polynomials that are factors - (11, 1), (33, 2), (93, 6), (341, 30). i.e there is one irreducible polynomial that divides $x^{11} + 1$, two that divide $x^{33} + 1$ etc. Interestingly $totient(11) = 10$ and $10/degree = 1$ all the way up to $totient(341)=300$ and $300/10=30$. Rest assured this pattern works for all degrees up to 12 at least.

Further - for degree 12 polynomials - there are $48$ polynomials that divide $2^{1365} + 1$ and, amazingly, totient(1365) = 576 = 12 * 48.

Is this another pattern I can rely on? Is it based on theory?

  • $\begingroup$ It looks like your G2 polynomials are what is commonly called polynomials with coefficients in the field of two elements, commonly denoted by either $GF(2)$ or $\mathbb{F}_2$. $\endgroup$ Jun 26 '13 at 7:04
  • 1
    $\begingroup$ Sometimes when you write $2^n+1$ did you mean $x^n+1$. Otherwise i can't make head or tails out of this. $\endgroup$ Jun 26 '13 at 7:06
  • $\begingroup$ But the algebraic properties of finite fields will explain your observations. Composing an answer using the degree ten polynomials as an example... $\endgroup$ Jun 26 '13 at 7:28
  • $\begingroup$ @JyrkiLahtonen - Thank you, now GF(2) - yes I do mean $2^n + 1$ (mostly), please see in my link how to test for primitivity. I look forward to your answer. $\endgroup$ Jun 26 '13 at 8:08
  • $\begingroup$ I suspect that any polynomial of degree ten and dividend $x^{62}+1$ actually factors. An irreducible polynomial cannot have that order (see my answer) and you seemed to have found too many irreducible polynomials of degree ten anyway. $\endgroup$ Jun 26 '13 at 9:06

You may need to familiarize yourself with the algebra of for all/any of the stuff below to make sense. I'm working out the case of irreducible degree $10$ polynomials in $GF(2)[x]$ according to what I think you are asking. I am not ruling out the possibility that I have completely misunderstood the context of your question. Anyway, my goals here are to A) outline some of the algebra, B) give you general formulas for the number of irreducible polynomials of a given degree and dividend. These you can test, and if there are differences, then we can work more to pinpoint the origin of the difference.

The number of irreducible polynomials of degree ten is $$ \frac1{10}\sum_{d\mid 10}\mu(d)2^{10/d}. $$ Here $\mu$ is the Möbius function. I have collected several links to answers on this site discussing this formula into my comment here, so I won't prove it here. The sum evaluates to $$ \frac1{10}\sum_{d\mid 10}\mu(d)2^{10/d}=\frac{2^{10}-2^5-2^2+2^1}{10}=99. $$ So something went wrong in you calculation. There are $99$ irreducible polynomials of degree ten, not $120$. Are you sure that your test for irreducibility works correctly?

If $p(x)$ is an irreducible polynomial with coefficients in $GF(2)$, then the task you are interested in is algebraically called as finding the order of $x$ in the quotient field $GF(2)[x]/(p(x))$. This is algebra speak for the smallest positive integer $d$ such that $p(x)$ is a factor of $x^n+1$. Your example telling us that the order of $x$ in $F=GF(2)[x]/(x^6+x^3+1)$ is equal to nine is correct.

It is a fact covered in all courses and textbooks on finite fields that their multiplicative group is cyclic. If $p(x)\in GF(2)[x]$ is an irreducible polynomial of degree $n$, then the order of that cyclic group is $2^n-1$. A result from a freshman abstract algebra course known as Lagrange's theorem tells us that the order of any element is a factor of the number of elements in the group. So for example, if $n=10$ we have that the order of $x$ in the multiplicative group of $F$ must be a factor of $1023$. Irrespective of the choice of the polynomial $p(x)$. You had correctly factored $1023=3\cdot11\cdot31$, so the possible orders are $1,3,11,31,33,93,341$ and $1023$. The last case is exactly the case of $x$ being a primitive element (and $p(x)$ being a primitive polynomial).

To cut a long story short I just state that no matter which irreducible polynomial $p(x)$ of degree ten is used, the resulting objects $F$ are isomorphic, which is a way of saying that they are the same object up to a permutation of the elements. That last phrase gives the catch that the coset of $x$ will move to another coset in that permutation. A consequence of this is that we can tally the orders of $x$ modulo all degree ten irreducible polynomials by tallying the orders of all the elements modulo a given irreducible polynomial $p(x)$. What's more is that we can do this with only a little bit more theory than that of the cyclic groups.

What that permutation of elements of $F$ does is that it allows us to group the elements of $F$ according to their so called minimal polynomials. The minimal polynomial of an element is the lowest degree polynomial with coefficients in $GF(2)$ that has the said element as its zero. One extra bit we need to worry about is that we can throw away those elements of $F$ that belong to a subfield of $F$. The field of $2^{10}$ has two subfield, those of size $2^2$ and $2^5$. The minimal polynomials of those elements have degrees $1,2$ or $5$, so we are not interested in them. This means that we won't concern ourselves with elements of orders $1,3$ or $31$, because they belong to those subfields.

But we can look at the more interesting cases, where the minimal polynomial is of degree ten. If $d\mid n$, and $G$ is a cyclic group of order $n$, then the number of elements of order $d$ in $G$ is known to be $\phi(d)$, where $\phi$ is the Euler totient function. If $d=p_1^{a_1}\cdots p_k^{a_k}$ is the prime factorization of $d$, then $$ \phi(d)=d\cdot(1-\frac1{p_1})(1-\frac1{p_2})\cdots(1-\frac1{p_k}). $$ Returning to our case of degree ten polynomials and $n=1023$. Let us look at the remaining factors $d=11$, $d=33$, $d=93$, $d=341$. We have $$ \phi(d)=33(1-\frac13)(1-\frac1{11})=20. $$ This tells us that there are 20 elements of order 33 in the multiplicative group of $F$. A minimal polynomial of any of those has ten roots in $F$ (Galois theory gives us this, we skip the proof). As the order only depends on the minimal polynomial, we see that between them those 20 elements have only two minimal polynomials. The conclusion will be that there are exactly two irreducible polynomials of degree ten and dividend $x^{33}+1$.

With $d=93$ we similarly calculate that $$ \phi(93)=93(1-\frac13)(1-\frac1{31})=60, $$ and conclude that there will be six irreducible polynomials of degree ten with dividend $x^{93}+1$. In the same vein, when $d=341$, we get $$ \phi(341)=300, $$ and conclude that there are thirty irreducible polynomials with dividend $x^{341}+1$ and, finally, as $\phi(1023)=600$, sixty irreducible with the maximal order $1023$.

In other words, out of the $99$ irreducible polynomials of degree ten, $60$ are primitive (you got that right!!!), $30$ have order $341$, six have order $93$, and two have order $33$. I seem to have left out order $11$. As $11$ is a prime, we have $\phi(11)=10$, so there is a single irredusible polynomial of degree ten and order $11$. We can actually say that this is the cyclotomic polynomial $$ p(x)=1+x+x^2+x^3+\cdots+x^{10} $$ that is (in this case) irreducible.

A lot of stuff. Some of the terminology may be Greek to you. But provided that I correctly understood what you are investigating, an immediate discrepancy is that the dividend $x^{62}+1$ should not occur at all. Can you give me an example of an irreducible polynomial of degree ten with that dividend? Then we can start debugging!

  • 1
    $\begingroup$ When will this answer be coming out in book form? $\endgroup$ Jun 26 '13 at 8:59
  • $\begingroup$ Yeah, I'm not very good at condensing, so I might benefit from such an exercise. Sorry about all the meandering. $\endgroup$ Jun 26 '13 at 9:57
  • $\begingroup$ +1 - Awesome! Attempting to absorb - may be some time. Your question about $x^{62} + 1$, it is the dividend for $x^{10} + x^4 + x^1$ among others. Link to the calculation. $\endgroup$ Jun 26 '13 at 10:28
  • $\begingroup$ @OldCurmudgeon: Was there a typo? Your link shows $$x^{10}+x^4+x^0=x^{10}+x^4+1$$ instead of $x^{10}+x^4+x$? Anyway, that polynomial is not irreducible because $$x^{10}+x^4+1=(x^5+x^2+1)^2.$$ The irreducible polynomial $x^5+x^2+1$ is (IIRC) primitve, and divides $x^{31}+1$. Not unnaturally its square then divides $(x^{31}+1)^2=x^{62}+1$. $\endgroup$ Jun 26 '13 at 10:36
  • 1
    $\begingroup$ You probably meant that if $2^n-1$ is prime? Yes, that is true: $2^5-1$ and $2^7-1$ are prime, so all irreducible polynomials of degrees five and seven are also primitive. Let's see, $2^{13}-1=8191$ is a prime (says Mathematica). Yes, all the 630 irreducible polynomials of degree 13 are then necessarily also primitive. There is something wrong with their program. $\endgroup$ Jun 27 '13 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.