ArticleslgStudy

computer science

Quadratic sieve

Quadratic sieve is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Quadratic sieve rather than just read about it. In short: The quadratic sieve algorithm (QS) is an integer factorization algorithm and, in practice, the second-fastest method known (after the general number field sieve). It is still the fastest for integers under 100 decimal digits or so, and is considerably simpler than the number field sieve.

Key takeaways

  • Quadratic sieve belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Quadratic sieve to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Quadratic sieve from memory before moving on to harder problems.

Reference excerpt

The quadratic sieve algorithm (QS) is an integer factorization algorithm and, in practice, the second-fastest method known (after the general number field sieve). It is still the fastest for integers under 100 decimal digits or so, and is considerably simpler than the number field sieve. It is a general-purpose factorization algorithm, meaning that its running time depends solely on the size of the integer to be factored, and not on special structure or properties. It was invented by Carl Pomerance in 1981 as an improvement to Schroeppel's linear sieve.

Basic aim The algorithm attempts to set up a congruence of squares modulo n (the integer to be factorized), which often leads to a factorization of n. The algorithm works in two phases: the data collection phase, where it collects information that may lead to a congruence of squares; and the data processing phase, where it puts all the data it has collected into a matrix and solves it to obtain a congruence of squares. The data collection phase can be easily parallelized to many processors, but the data processing phase requires large amounts of memory, and is difficult to parallelize efficiently over many nodes or if the processing nodes do not each have enough memory to store the whole matrix. The block Wiedemann algorithm can be used in the case of a few systems each capable of holding the matrix. The naive approach to finding a congruence of squares is to pick a random number, square it, divide by n and hope the least non-negative remainder is a perfect square. For example, 80 2 ≡ 441 = 21 2 ( mod 5959 ) {\displaystyle 80^{2}\equiv 441=21^{2}{\pmod {5959}}} . This approach finds a congruence of squares only rarely for large n, but when it does find one, more often than not, the congruence is nontrivial and the factorization is complete. This is roughly the basis of Fermat's factorization method. The quadratic sieve is a modification of Dixon's factorization method. The general running time required for the quadratic sieve (to factor an integer n) is conjectured to be

e ( 1 + o ( 1 ) ) ln ⁡ n ln ⁡ ln ⁡ n = L n [ 1 / 2 , 1 ] {\displaystyle e^{(1+o(1)){\sqrt {\ln n\ln \ln n}}}=L_{n}\left[1/2,1\right]}

in the L-notation. The constant e is the base of the natural logarithm.

The approach To factorize the integer n, Fermat's method entails a search for a single number a, n1/2 < a < n−1, such that the remainder of a2 divided by n is a square. But these a are hard to find. The quadratic sieve consists of computing the remainder of a2/n for several a, then finding a subset of these whose product is a square. This will yield a congruence of squares. For example, consider attempting to factor the number 1649. We have: 41 2 ≡ 32 , 42 2 ≡ 115 , 43 2 ≡ 200 ( mod 1649 ) {\displaystyle 41^{2}\equiv 32,42^{2}\equiv 115,43^{2}\equiv 200{\pmod {1649}}} . None of the integers 32 , 115 , 200 {\displaystyle 32,115,200} is a square, but the product 32 ⋅ 200 = 80 2 {\displaystyle 32\cdot 200=80^{2}} is a square. We also had

32 ⋅ 200 ≡ 41 2 ⋅ 43 2 = ( 41 ⋅ 43 ) 2 ≡ 114 2 ( mod 1649 ) {\displaystyle 32\cdot 200\equiv 41^{2}\cdot 43^{2}=(41\cdot 43)^{2}\equiv 114^{2}{\pmod {1649}}}

since 41 ⋅ 43 ≡ 114 ( mod 1649 ) {\displaystyle 41\cdot 43\equiv 114{\pmod {1649}}} . The observation that 32 ⋅ 200 = 80 2 {\displaystyle 32\cdot 200=80^{2}} thus gives a congruence of squares

114 2 ≡ 80 2 ( mod 1649 ) . {\displaystyle 114^{2}\equiv 80^{2}{\pmod {1649}}.}

Hence 114 2 − 80 2 = ( 114 + 80 ) ⋅ ( 114 − 80 ) = 194 ⋅ 34 = k ⋅ 1649 {\displaystyle 114^{2}-80^{2}=(114+80)\cdot (114-80)=194\cdot 34=k\cdot 1649} for some integer k {\displaystyle k} . We can then factor

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Quadratic sieve

Start with the simplest possible case. Write down what Quadratic sieve claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Quadratic sieve before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Quadratic sieve ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Quadratic sieve

In research
Quadratic sieve appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Quadratic sieve in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Quadratic sieve is common in secondary-school and first-year university syllabi. It links to neighbouring topics Integer factorization algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Quadratic sieve outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Quadratic sieve” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Quadratic sieve in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Quadratic sieve means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Quadratic sieve out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Quadratic sieve in simple terms?

The quadratic sieve algorithm (QS) is an integer factorization algorithm and, in practice, the second-fastest method known (after the general number field sieve). It is still the fastest for integers under 100 decimal digits or so, and is considerably simpler than the number field sieve.

Why does Quadratic sieve matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Quadratic sieve?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Quadratic sieve.

Tags

  • Integer factorization algorithms

Keep exploring