Currently there may be errors shown on top of a page, because of a missing Wiki update (PHP version and extension DPL3).
Navigation
Topics Help • Register • News • History • How to • Sequences statistics • Template prototypes

SNFS polynomial selection

From Prime-Wiki
Jump to: navigation, search

For the SNFS factorization you need two polynomials with small coefficients and a common root modulo N, the number to be factored. Typically one polynomial is of degree 4, 5 or 6 (the algebraic side) and the other one is linear (the rational side).

Cyclotomic numbers

For cyclotomic numbers, there are four standard operations you can perform on the number to derive suitable polynomials:

  1. Multiplying by a constant
  2. Increasing or decreasing a power
  3. Dividing out algebraic factors
  4. halving the degree of a symmetric polynomial

1. Suppose you want to factor a number of the form a591 for a given a with a quintic (a degree 5 polynomial). You can multiply N by a and get aN=a60a, which you can express as x5a with root m=a12. For example, the smallest a591 number currently not completely factored is 208591, the polynomials would be x5208 on the algrebraic side and x6557827967253220516257857536 on the rational side. Multiplying N by a constant increases the SNFS difficulty of the factorisation.

2. If you want to factor a611, you can rewrite the power as aa60 and get aa601, or ax51, again with root m=a12. Thus, your polynomials are, for example for N=208611, 208x51 and x6557827967253220516257857536.

You can use both methods to get the exponent a multiple of the degree you want to use, choose the one that minimises the largest coefficient of the algebraic polynomial.

You can also combine both methods if the base is composite. If you want to factor, say, 101131 with a quintic, you could use 1000x51 (difficulty 113) or x5100 (difficulty 115) by the method of 1. or 2. alone.

But you can also first multiply N by 52 to get 25N=2113511525, then rewrite as 8(21105115)25, or 8x525, with root m=222523 (difficulty ~114). So your polynomials are 8x525 and x50000000000000000000000. The advantage is that the largest coefficient in the algebraic poly is now only 25 instead of 100 and you still have a low difficulty.

3. If your exponent is divisible by 3, 5 or 7, you can divide out an algebraic factor and immediately get a polynomial of suitable degree and small coefficients.

  • (a3k1)/(ak1)=a2k+ak+1 which can be converted to a quadratic x2+x+1 with root ak. However, a quadratic has too small degree, the coefficients on the rational side would become huge. Instead, if k is odd, we write a2a2(k1)+aak1+1 and can convert to a quartic in a(k1)/2. If you want a sextic, tweak the exponents accordingly by 2., perhaps multiplying by a power of a (as in 1.) to get small coefficients.
  • (a5k1)/(ak1)=a4k+a3k+a2k+ak+1, which is a useable quartic in ak.
  • (a7k1)/(ak1)=a6k+a5k+a4k+a3k+a2k+ak+1, which is a useable sextic in ak.

4. For a11k1 and a13k1 you'd get degrees 10 and 12, respectively - too large. But the resulting polynomial is symmetric: (for the sake of less typing, let b=ak)

(b111)/(b1)=b10+b9+b8+b7+b6+b5+b4+b3+b2+b+1

We can multiply this by b5:

b5+b4+b3+b2+b+1+b1+b2+b3+b4+b5

and regroup

b5+b5+b4+b4+b3+b3+b2+b2+b+b1+1 (1)

Now we'd like to replace b5+b5 by, say, (b+b1)5, but that gives us more terms than just b5+b5 due to the binomial theorem: (b+b1)5=b5+5b3+10b+10b1+5b3+b5, and we have b5+b5=(b+b1)55b310b10b15b3.

Fortunately, those extra terms are again of the form c(bn+bn) and can be combined with the other summands of (1):

((b+b1)55b310b10b15b3)+b4+b4+b3+b3+b2+b2+b+b1+1=::(b+b1)5+b4+b44(b3+b3)+b2+b29(b+b1)+1

Handle the term b4+b4 the same way, etc.

In the end, you'll have a polynomial

c5(b+b1)5+c4(b+b1)4+c3(b+b1)3+c2(b+b1)2+c1(b+b1)+c0.

Thus, you can use the quintic c5x5+c4x4+c3x3+c2x2+c1x+c0 with root b+1/b.

The siever input file wants the root as an integer, so you have to do a modular inversion: in Pari/GP, use Mod(b+1/b,N)

where you assigned N=(cofactor of a11k1), b=(value of ak) before. The result will be printed as

Mod(M,N)

where the value in place of M is the desired root.

The linear poly will be x(b+b1). Using xM directly is no good as M is about as large as N itself, so the linear polynomial would have a far too large coefficient. Instead, multiply the polynomial by b:

g(x)=bx(b2+1)

Now the coefficients b and (b2+1) are small enough.

The method for getting the coefficients of the algebraic polynomial above shows why we should do a change of variable to b+b1, but it is a tedious way of actually getting the coefficients. It is easier to just set up a polynomial

f(x)=a5x5+a4x4+a3x3+a2x2+a1x+a0,

and writing the difference

f(b+1/b)*b^5 - (b^11-1)/(b-1)

in Pari/GP (with b as a variable, not the value of ak). This yields

(a51)b10+(a41)b9++(a41)b+(a51)

and we want the difference to be zero, so we can immediately set

a5=1
a4=1

Evaluating the difference again yields

(a3+4)b8+(a2+3)b7+...+(a2+3)b3+(a3+4)b2

so we set

a3=4
a2=3

Now the difference is

(a13)b6+(a01)b5+(a13)b4

so we set

a1=3
a0=1

This produces the polynomials

f(x)=x5+x44x33x2+3x+1
g(x)=bx(b2+1)

with common root M=b+1/b (modN) and b=ak.

Similarly for numbers of the form a13k1.

See also