Main Page   Reference Manual   Compound List   File List

# Factorization of 2^m - 1

## Chronological History

On January 12th 2007, I wrote down the factorization of 2m - 1 for m=2...16 because I was interested to see where a factor of the form 2n + 1 would appear. I took the piece of paper to bed with me, to study it, when suddenly I saw structure (conjecture 1, with n equal zero). I got out of bed again and copied the factorization of 2m - 1 for m=17...36 as well. Back in bed, I verified that my conjecture still held and discovered the structure of conjecture 1 with n=1 (and a single data point with n=2). I studied the remaining factors and discovered they all had the form (c m + 1) (conjecture 2). I didn't sleep much that night.

The next day I wrote a program (factorization2.cc) that used conjecture 1, and refined this conjecture in it's current form (still without proof). Then I extended the program to find the factorization of the remaining factors using brute force, which worked extremely fast till m=58 and reached m=82 over night. Studying 211 - 1, I realized that the binomial expansion of (1+1)11 might be relevant and I thought that if I understood why the remaining factors were all of the form (c m + 1) then I might discover a way to find those factors a lot faster. In the next few days I extended the program to use the Cunningham tables in order to have the factors up till 2787 - 1 available, giving me a large control set. I also proved conjecture 1 to hold for n=0 and n=1.

Larger values turned out to be very hard to prove. I downloaded a trial version of Mathematica on January 17th, and started to learn how to use it. After a few days I could calculate the remainder of (xkm - 1) / (xm - 1)n, but only for fixed values of k, m and n. Nevertheless, by using a few prime values for m and very large values for k, I was able to guess a form for the remainders as polynomials in k for n=2...6. This remainder contained a lot of fixed numbers that I couldn't place for several days until finally I plotted the polynomials of k, that I had fit to the data, and found that for constant n they all crossed the same n+1 points. Rearranging things a bit I then formulated the "Pink polynomials" and the next couple of days derived a general form for them.

Having this general form, I was able to prove the correctness of conjecture 1 for n=2...5. A day later I added the last part and finished the proof for arbitrary n. Conjecture 1 was now proved. This was today January 23th, at which point I started to write this document. Anything else will be chronological, adding it as I move forwards.

The actual proof of conjecture 1 is impossible if you do not first know the answer. It took three weeks to find that answer (it is now Februari 17th). It would take too long to show the path followed that lead to the answer. However, I wish to thank Neil Sloane for an important contribution that led to this result, by finding a way to generate a pyramid of integers that I had generated along the way.

## A simple pattern

### CONJECTURE 1

Let k, m, n be non-negative integers, x an integer larger than 0, and p prime. If and then .

#### PROOF

If x = 1, k = 0 or m = 0 there is nothing to prove. Therefore consider the case where x > 1, k > 0 and m > 0.

Let u = xm, thus u > 1. It won't be used that u is a power of x until at the end of the proof.

Let n be a non-negative integer, and recall that

 (1)

and

 (2)

Consider the equation

 (3)

which defines the function Rn,k(u),

 (4a)

Using (1), we can work out the sum

 (5a)

This sums over 0 <= j <= n and 0 <= i < k-n.

What we'd like is to sum over i+j. Let r = i+j with a total range of 0 <= r < k. Because the binomial is zero for values of j < 0 and j > n, we can savely replace the sum over j with a sum over r, so that (5a) becomes,

 (5b)

Where the first binomial will be non-zero only when 0 <= r-i <= n and the second binomial will be non-zero only when n <= k-1-i. In otherwords, the only non-zero terms are those when max(0,r-n) <= i <= min(r,k-n-1). If k-n-1 < r but we sum till r anyway, then this is no problem because for values of i > k-n-1, the second binomial is zero anyway. Therefore we can sum over max(0,r-n) <= i <= r. This then suggests we should split the sum into two parts, one where r < n and one where r >= n.

 (5c)

Using the identity [KNUTH, 5.43], we can rewrite the inner sum of the second term as

 (6)

Now we can rewrite (4), using (2), (5c) and (6) to read

 (4b)

where is the Heaviside step function,

 (7)

Define for non-negative k and 0 <= i < n, the family of functions

 (8)

Then we can write Rn,k(u) as

 (4c)

Note that because the sum in (8) is empty for k <= n, we found that

 (9)

We can rewrite the sum in (8) a bit. Note that, using [KNUTH, 5.43] again,

 (10)

and thus, if k-n-1 <= i,

 (11)

Then note that the value of k-1-j in the last binomial factor of the last sum is maximal when j is minimal. This minimal value is k-n, thus the maximum value of the k-1-j is k-1-(k-n) = n-1, rendering this binomial, and therefore the whole sum, zero provided that k-1-j >= 0 for all values of j. The minimal value of k-1-j is obtained for j = i, so that we can conclude that the second sum is zero if k > i.

While if k-n-1 >= i then (10) can be written as

 (12)

because for all values of j.

Hence, we have

 (13)

And, with k >= 0, we can write (8) as

 (14)

Lets try to write Pi,n(k) as a finite sum of powers of k. We can find the highest power by using the finite difference method. This method shows that we can write a sequence as a polynomial of degree n, if the n-th difference gives a constant sequence. As we can learn from this wikipedia reference about the n-th difference operator , there exists a formula that will give us directly the d-th difference:

 (15)

Because of (9) we known that the degree is at least n. Experimentally fitting polynomials to calculated data gives polynomials of exactly degree n that are correct up till very large k. This motivates us to try d = n and calculate , using (9) and the identity from wikipedia for the last step, to get

 (16)

If this is to be a constant (with fixed i and n) for larger values of k, then we have proven that Pi,n(k) can actually be written as a polynomial in k of degree n. That is, we have to show that for k >= n, , where is given by the recurrence

 (17)

As follows directly from (9), . In fact, Pi,n(k) = 1, if i < k <= n, and as follows directly from (15), depends only on the values of Pi,n(r) with k <= r <= k+d, so that , if i < n-d <= n. Moreover, as also follows directly from (9), Pi+1,n+1(k+1) = Pi,n(k), for 0 <= k <= n, because if you add one to k and n then k is still less than or equal n so that (9) still holds, and H[k-1-i] doesn't change. Thus we have the identity , if 0 <= k <= n - d, which translates into , if d > 0 and i >= n-d. Note that d = 0 fails because (9) demands that i < n, thus n > 0, and (16), which we'll need, puts d = n. Combining, we find that

 (18)

Thus, using (16), and realizing that if d > 0 and i < n - d, we can rewrite (17) as

 (19)

where as usual, 0 <= i < n and k >= 0.

Actually, if the binomial was correctly defined for negative values, the separation for d = 0 wouldn't have been necessary. According to me, the correct definition of a binomial of two negative values is , and thus, for d = 0, we have .

As an example, consider the following solution to D3,8(d, k).

where k runs from left to right from 0 till 11, and d runs from top to bottom from 0 till n = 8. The top row is therefore P3,8(k) and the first n+1 = 9 values equal H[k-1-i] = H[k-4]. The bottom row is D3,8(8,k) = (-1)n-1-i = (-1)(8-1-3) = 35.

Since the last identity of (19) holds everywhere, it is actually easiest to generate D from the bottom line and the first column. The first column is

 (20)

If binomial had been defined correctly for negative values, then the special case for d = 0 would not have been necessary. Unfortunately, it is. Therefore things are easier if we redefine D as

 (21)

This obviously has no influence on the values of D for d > 0, while the top row is simply reduced with 1.

It's not hard to see that this will make life a lot easier. The recurrence rules that generate D1 do not have any special cases.

 (22)

It's not hard to construct D1i,n(d,k) from this. Each value in the left column gives an independent contribution that adds up to the rest. Consider a single 1 in the left column (with a row of zeroes below it). This would lead to:

from which we clearly see that a 1 in row j contributes to D1i,n(d,k). Moreover, since it's all addition, every additional 1 that is added to the same row in the first column gives the same contribution. Hence, a value x in row j contributes to D1i,n(d,k). "Summing it all up" gives us the result

 (23)

And thus we found that

 (24)

which proves that Pi,n(k) can be written as a polynomial in k of degree n. In fact, we can write it as a product of k and a polynomial of degree n-1 because Pi,n(0) = 0 for any i and n. Define

 (25)

with coefficients c(s,i,n) that later will turn out to be integers (thanks to the wise choice of deviding by n! outside the sum).

Filling this in into (4c) gives

 (26)

where

 (27)
 (1)

p devides xm-1, thus pn+1 devides the first term. What remains is to prove that pn devides the second sum. As was shown before, k devides and thus the second sum, and pn | k, so we are done.

## The Pink Polynomials

I ran into these functions, basically by first finding the polynomials for n=1...6 given below and then discovering a structure in them. I named them "Pink" polynomials for an obvious reason. The 'P' stands for Polynomial.

The canonical definition of the Pink polynomial is that they are polynomials in the variable k, of degree n, defined for , where

 (1)

#### Lemma 1

The polynomials can be constructed in the following "brute force" way,

 (2)

where the first product takes care of the zeroes between 0 and i, while the sum takes care of the ones between i and n.

#### Proof

If 0 k i, then one of the factors of is zero, and therefore (2) is zero, while if i < k n, then each of the terms of the sum is zero except the one where j = k. Therefore (2) becomes k!/(k-(i+1))! (-1)n+k n!/(k! (n-k)!) (k-(i+1))! (-1)n-k (k-n)! /n! = 1.

#### Examples

Here is a list of all Pink polynomials for n <= 6,

n=1
n=2
n=3
n=4
n=5
n=6

#### Properties Of The Pink Polynomials

The Pink polynomials have the following properties.

, as follows directly from the definition (1). In other words, they all have k=0 as zero and thus k as factor.

The polynomials can be written as k/n! Q(k) where Q(k) is a polynomial of degree n-1 over . This follows trivially from (2).

 (3)

Since Q(k) is a polynomial of degree n-1, we should also be able to write this as,

 (4)

Where the cs are the coefficients of the polynomial.

For , define

 (5a)

Since this function is my own invention, allow me to give a quick overview of some of it's characteristics,

 (5b)

P.S. It turns out that the are known as the unsigned Stirling numbers of the first kind: .

It can be derived that

 (6)

from which we can conclude that for

 (7)

Hence, we can rewrite (3) as,

 (8)

and thus found an expression of the of (4),

 (9a)

Map j --> j+i+1, r --> r+s+i+1-n, l --> l+f then z --> z+j+i+1-n, then h --> h+s-z to get,

 (9b)

We might as well start the sum over f from ((n-1-i)-j)-h because for smaller f, z-h-f > z-((n-1-i)-j) and the subsequent binomial is zero anyway. Map f --> f+((n-1-i)-j)-h to get something that starts at 0 again and we have,

 (9c)

Apparently it makes more sense to number i and s the other way around. Let , . Also inverse j and r, and replace some binomials with .

 (9d)

where the last (actually, non trivial) transformation makes sure that is never called with negative arguments. Nevertheless, now it is apparent that we can simplify this even more by also inverting r (relative to ). This then gives

 (9e)

Filling in k = 0 in (7), and replacing a with -a gives the relationship:

 (10)

#### Lemma 2

The sum over i of the constant term of each Pink function, , equals n factorial.

#### Proof

where the last step is due to the well-known fact that for .

#### Lemma 3

and therefore k devides , where the ci are integer constants, for any value of (and any n).

----

New identity used: Integers n,m,a

if a > 0.