# 数学代写|密码学代写cryptography theory代考|CS388H

## 数学代写|密码学代写cryptography theory代考|The Sieve of Eratosthenes

The sieve of Eratosthenes finds the primes below some limit $J$. It writes the numbers $1,2, \ldots, J$. Then it crosses out the number 1 , which is not prime. After that, let $p$ be the first number not crossed out. Cross out all multiples of $p$ greater than $p$. Repeat these steps, replacing $p$ by the next number not yet crossed out, as long as $p \leq \sqrt{J}$. When $p$ reaches $\sqrt{J}$ all numbers crossed out are composite (or 1) and all numbers not crossed out are prime.

A computer program would use an array $P[]$ to represent the numbers 1 to $J$. Let ‘ 1 ‘ mean that the number is not crossed out and ‘ 0 ‘ mean that the number is crossed out. The algorithm starts by marking 1 as ‘crossed out’ and the other numbers as ‘not crossed out’. For each prime $p$, cross out all multiples of the prime $p$. Then the first number not yet crossed out is the next prime $p$. At the end, the value of $P[i]$ is 1 if $i$ is prime and 0 if $i$ is 1 or composite. The sieve of Eratosthenes computes all primes $\leq J$ in $O(J \log \log J)$ steps.

A variation of this sieve factors the numbers in the range of a polynomial $f(x)$ with integer coefficients, but it only finds the prime factors of each $f(x)$ that lie in a finite set $\mathcal{P}$ of primes. The polynomial $f(x)$ is fixed. This sieve algorithm (see Algorithm 3.4) is the heart of the quadratic and number field sieve factoring algorithms. For each $i$, a linked list $L[i]$ holds the distinct prime factors of $f(i)$.

The output $L[i]$ lists only the distinct prime factors of $f(i)$ in $\mathcal{P}$. A modification of this algorithm also finds the number of repetitions of each prime factor of $f(i)$ without ever forming that number, which may be huge.

## 数学代写|密码学代写cryptography theory代考|The Quadratic Sieve Factoring Algorithm

The quadratic sieve factoring algorithm, QS, and the CFRAC differ only in the method of producing relations $x^2 \equiv q(\bmod n)$ with $q$ factored completely. The CFRAC forms $x$ and $q$ from the continued fraction expansion of $\sqrt{n}$ and factors $q$ by slow trial division. The QS produces $x$ and $q$ using a quadratic polynomial $q=f(x)$ and factors the $q$ with a sieve, much faster than trial division. The quadratic polynomial $f(x)$ is chosen so that the $q$ will be as small as possible. Most of these $q$ will exceed $2 \sqrt{n}$, but not by a large factor, so that they are almost as likely to be smooth âs the $q$ in CFRAC.
Let $f(x)=x^2-n$ and $s=\lceil\sqrt{n}\rceil$. The QS factors some of the numbers
$$f(s), f(s+1), f(s+2), \ldots$$
by Algorithm 3.4. If there are $K$ primes in the factor base and we find $R>K$ $B$-smooth numbers $f(x)$, then there will be $R$ relations involving $K$ primes and linear algebra will produce at least $R-K$ congruences $x^2 \equiv y^2(\bmod n)$, each of which has probability at least $1 / 2$ of factoring $n$, by Theorem 3.7.

Sieve by using the fast Algorithm $3.4$ to find the $B$-smooth numbers among $f(s), f(s+1), f(s+2), \ldots$. The factor base $\mathcal{P}$ consists of the primes $p<B$ for which the Legendre symbol $(n / p) \neq-1$. Write the numbers $f(s+i)$ for $i$ in some interval $a \leq i<b$ of convenient length. The first interval will have $a=s$. Subsequent intervals will begin with $a$ equal to the endpoint $b$ of the previous interval. For each prime $p<B$, remove all factors of $p$ from those $f(s+i)$ that $p$ divides. Because $f(x)=x^2-n, p$ divides $f(x)$ precisely when $x^2 \equiv n(\bmod p)$. The solutions $x$ to this congruence lie in the union of two arithmetic progressions with common difference $p$. If the roots of $x^2 \equiv n(\bmod p)$ are $x_1$ and $x_2$, then the arithmetic progressions begin with the first numbers $\equiv x_1$ and $x_2(\bmod p)$ which are $\geq a$. The sieve is much faster than trial division. Pomerance [478] proved that the time complexity of the QS is $L(n)=\exp (\sqrt{(\ln n) \ln \ln n})$.

# 密码学代考

## 数学代写|密码学代写cryptography theory代考|The Sieve of Eratosthenes

Eratosthenes 篩法发现低于某个极限的溸数 $J$. 它写数字 $1,2, \ldots, J$. 然后它划掉数字 1 ，它不是溸数。

## 数学代写|密码学代写cryptography theory代考|The Quadratic Sieve Factoring Algorithm

$$f(s), f(s+1), f(s+2), \ldots$$

myassignments-help数学代考价格说明

1、客户需提供物理代考的网址，相关账户，以及课程名称，Textbook等相关资料~客服会根据作业数量和持续时间给您定价~使收费透明，让您清楚的知道您的钱花在什么地方。

2、数学代写一般每篇报价约为600—1000rmb，费用根据持续时间、周作业量、成绩要求有所浮动(持续时间越长约便宜、周作业量越多约贵、成绩要求越高越贵)，报价后价格觉得合适，可以先付一周的款，我们帮你试做，满意后再继续，遇到Fail全额退款。

3、myassignments-help公司所有MATH作业代写服务支持付半款，全款，周付款，周付款一方面方便大家查阅自己的分数，一方面也方便大家资金周转，注意:每周固定周一时先预付下周的定金，不付定金不予继续做。物理代写一次性付清打9.5折。

Math作业代写、数学代写常见问题

myassignments-help擅长领域包含但不是全部: