To write a quadratic or number sieve for factoring numbers, a solid understanding of modular arithmetic, quadratic residues, and some linear algebra is essential, with the quadratic sieve being easier to grasp than the number field sieve. While the quadratic sieve is generally superior for most applications, especially for smaller numbers, the number field sieve requires deeper knowledge of algebraic number theory for full comprehension. Implementing optimizations, such as multiple polynomial variations, is crucial for efficiency, as demonstrated by significant speed differences in factoring times. Familiarity with programming, particularly in C++, is recommended for practical implementation, along with an understanding of computer architecture to optimize performance. Overall, starting with simpler factoring methods may also be beneficial before tackling the quadratic sieve.