This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

A log-log speedup for exponent one-fifth deterministic integer factorisation

David Harvey School of Mathematics and Statistics, University of New South Wales, Sydney NSW 2052, Australia [email protected]  and  Markus Hittmeir SBA Research, Floragasse 7, A-1040 Vienna [email protected] Dedicated to Richard Brent on the occasion of his (3×52)(3\times 5^{2})-th birthday
Abstract.

Building on techniques recently introduced by the second author, and further developed by the first author, we show that a positive integer NN may be rigorously and deterministically factored into primes in at most

O(N1/5log16/5N(loglogN)3/5)O\left(\frac{N^{1/5}\log^{16/5}N}{(\log\log N)^{3/5}}\right)

bit operations. This improves on the previous best known result by a factor of (loglogN)3/5(\log\log N)^{3/5}.

2020 Mathematics Subject Classification:
Primary 11Y05
The first author was supported by the Australian Research Council (grant FT160100219).
SBA Research (SBA-K1) is a COMET Centre within the framework of COMET – Competence Centers for Excellent Technologies Programme and funded by BMK, BMDW, and the federal state of Vienna. The COMET Programme is managed by FFG
copyright: ©2021: David Harvey and Markus Hittmeir

1. Introduction

The aim of this paper is to further refine a method for integer factorisation that was recently introduced by the second author [Hit20], and subsequently improved and simplified by the first author [Har20]. We insist that all algorithms under discussion be deterministic and that all complexity bounds be proved rigorously. Faster factoring algorithms are known if one allows randomisation, heuristic arguments or quantum computers; see [CP05, Len00, Wag13, Rie94].

We write 𝖥(N)\operatorname{\mathsf{F}}(N) for the time required to compute the prime factorisation of an integer N2N\geqslant 2, where “time” means “bit operations”, i.e., the number of steps performed by a deterministic Turing machine with a fixed, finite number of linear tapes [Pap94]. All integers are assumed to be encoded in the usual binary representation.

Prior to [Hit20], the best known asymptotic bounds for 𝖥(N)\operatorname{\mathsf{F}}(N) were of the form N1/4+o(1)N^{1/4+o(1)}. These were achieved by methods going back to Pollard, Strassen and Coppersmith; for further references see [Har20]. The algorithm presented in [Hit20] was the first to break the 1/41/4 barrier, achieving 𝖥(N)=N2/9+o(1)\operatorname{\mathsf{F}}(N)=N^{2/9+o(1)}. Shortly afterwards the first author made further progress on the exponent [Har20], showing that 𝖥(N)=O(N1/5log16/5N)\operatorname{\mathsf{F}}(N)=O(N^{1/5}\log^{16/5}N). The main result of the present paper is the following incremental improvement.

Theorem 1.1.

There is a deterministic integer factorisation algorithm achieving

𝖥(N)=O(N1/5log16/5N(loglogN)3/5).\operatorname{\mathsf{F}}(N)=O\left(\frac{N^{1/5}\log^{16/5}N}{(\log\log N)^{3/5}}\right).

Note that if NN has three or more prime factors (counting repetitions), then at least one factor is bounded above by N1/3N^{1/3}, and it is well known that such a factor may be found in time N1/6+o(1)N^{1/6+o(1)} (see for example [Har20, Prop. 2.5]). Using this observation one easily reduces the proof of Theorem 1.1 to the case that NN is either prime or semiprime, i.e., a product of two distinct primes. For details of the reduction, see the proof of [Har20, Thm. 1.1]. For the rest of the paper, we assume that NN is either prime or semiprime, say N=pqN=pq where p<qp<q.

The strategy of [Har20] may be outlined as follows. Fix some integer α\alpha coprime to NN. Since p1(modp1)p\equiv 1\pmod{p-1}, Fermat’s little theorem implies that αaq+bpαaN+b(modp)\alpha^{aq+bp}\equiv\alpha^{aN+b}\pmod{p} for any a,ba,b\in\mathbb{Z}. If we can recover aq+bpaq+bp, for known coefficients a,b0a,b\neq 0, then it is easy to deduce pp and qq, since we know the product pq=Npq=N (see Lemma 2.4). Now, it was observed by Lehman [Leh74] (following ideas going back to Lawrence [Law95]) that if aa are bb are small integers, chosen so that a/ba/b is a good rational approximation to the unknown p/qp/q, then aq+bpaq+bp will be especially close to (4abN)1/2(4abN)^{1/2}. This suggests rewriting the congruence as

αaq+bp(4abN)1/2αaN+b(4abN)1/2(modp).\alpha^{aq+bp-\lfloor(4abN)^{1/2}\rfloor}\equiv\alpha^{aN+b-\lfloor(4abN)^{1/2}\rfloor}\pmod{p}.

When a/bp/qa/b\approx p/q, the left hand side has the form αi\alpha^{i} where ii is “small”. Consequently, to solve for aq+bpaq+bp, it suffices to find a collision modulo pp between the “giantsteps” αaN+b(4abN)1/2(modN)\alpha^{aN+b-\lfloor(4abN)^{1/2}\rfloor}\pmod{N}, where a/ba/b ranges over some sufficiently dense set of rational numbers, and the “babysteps” αi(modN)\alpha^{i}\pmod{N}, where ii ranges over small integers. This collision-finding problem may be attacked using tools from fast polynomial arithmetic, and [Har20] shows that this strategy (after filling in many details left out in this rough sketch) leads to the bound 𝖥(N)=O(N1/5log16/5N)\operatorname{\mathsf{F}}(N)=O(N^{1/5}\log^{16/5}N).

The new algorithm in this paper follows the same basic plan described above, but utilises the additional information that pp and qq cannot themselves be divisible by small primes. We modify the algorithm so that it restricts attention to candidates for pp that are coprime to m2×3×5××pdN1/2m\coloneqq 2\times 3\times 5\times\cdots\times p_{d}\ll N^{1/2}, i.e., mm is the product of the first dd primes for suitable dd. The number of possible values of pp modulo mm is ϕ(m)\phi(m) (the Euler totient function), and for suitable choice of m=NO(1)m=N^{O(1)}, Mertens’ theorem (see Lemma 2.6) implies that the ratio ϕ(m)/m\phi(m)/m decays like 1/loglogN1/\log\log N. This is the source of the log-log savings over [Har20]. Actually, for technical reasons we reorganise the algorithm considerably: instead of defining the giantsteps by taking all pairs (a,b)(a,b) in some range, as is done in [Har20], we use algorithms for finding short lattice vectors to compute suitable values for aa and bb for each giantstep.

Of course it is well known that sieving on small primes in this way often leads to (loglogN)(\log\log N)-type speedups. For example, in the context of deterministic integer factorisation, this idea was used in [CH14] to improve the complexity of the factoring algorithm of [BGS07] by a factor of (loglogN)1/2(\log\log N)^{1/2}.

2. Preliminaries

For nn a positive integer, we define lgnlogn/log2+1\lg n\coloneqq\lfloor\log n/\log 2\rfloor+1. Observe that lgn1\lg n\geqslant 1 for all n1n\geqslant 1, that lgn=Θ(logn)\lg n=\Theta(\log n) for n2n\geqslant 2, and that lgn\lg n may be computed in time O(lgn)O(\lg n).

We recall several facts about integer arithmetic. All results stated here without specific references may be found in textbooks such as [vzGG13] or [BZ11].

Let n1n\geqslant 1, and assume that we are given integers xx and yy such that |x|,|y|2n|x|,|y|\leqslant 2^{n}. We may compute x+yx+y and xyx-y in time O(n)O(n). We write 𝖬(n)\operatorname{\mathsf{M}}(n) for the cost of computing the product xyxy; it was shown recently that 𝖬(n)=O(nlgn)\operatorname{\mathsf{M}}(n)=O(n\lg n) [HvdH21]. If y>0y>0, we may compute the quotients x/y\lfloor x/y\rfloor and x/y\lceil x/y\rceil, and therefore also the residue of xx modulo yy in the interval [0,y)[0,y), in time O(𝖬(n))O(\operatorname{\mathsf{M}}(n)). More generally, for a fixed positive rational number u/vu/v, and assuming that x,y>0x,y>0, we may compute (x/y)u/v\lfloor(x/y)^{u/v}\rfloor and (x/y)u/v\lceil(x/y)^{u/v}\rceil in time O(𝖬(n))O(\operatorname{\mathsf{M}}(n)). We may compute ggcd(x,y)g\coloneqq\gcd(x,y), and if desired find u,vu,v\in\mathbb{Z} such that ux+vy=gux+vy=g (i.e., solve the extended GCD problem), in time O(𝖬(n)lgn)=O(nlg2n)O(\operatorname{\mathsf{M}}(n)\lg n)=O(n\lg^{2}n).

Next we consider modular arithmetic. Let N2N\geqslant 2. We write N\mathbb{Z}_{N} for the ring /N\mathbb{Z}/N\mathbb{Z} of integers modulo NN. Elements of N\mathbb{Z}_{N} will always be represented by their residues in the interval [0,N)[0,N), so occupy O(lgN)O(\lg N) bits of storage. We write N\mathbb{Z}_{N}^{*} for the group of units of N\mathbb{Z}_{N}, i.e., the subset of those xNx\in\mathbb{Z}_{N} for which gcd(x,N)=1\gcd(x,N)=1. Given x,yNx,y\in\mathbb{Z}_{N}, we may compute x±yNx\pm y\in\mathbb{Z}_{N} in time O(lgN)O(\lg N), and xyNxy\in\mathbb{Z}_{N} in time O(𝖬(lgN))=O(lgNlglgN)O(\operatorname{\mathsf{M}}(\lg N))=O(\lg N\lg\lg N). Given xNx\in\mathbb{Z}_{N} and an integer m1m\geqslant 1, we may compute xmNx^{m}\in\mathbb{Z}_{N} in time O(𝖬(lgN)lgm)O(\operatorname{\mathsf{M}}(\lg N)\lg m), using the “repeated squaring” algorithm. We may test whether xNx\in\mathbb{Z}_{N}^{*}, and if so compute x1Nx^{-1}\in\mathbb{Z}_{N}^{*}, in time O(𝖬(lgN)lglgN)=O(lgN(lglgN)2)O(\operatorname{\mathsf{M}}(\lg N)\lg\lg N)=O(\lg N(\lg\lg N)^{2}), by solving the extended GCD problem for xx and NN. If the gcd is not 11 or NN, and if N=pqN=pq is semiprime, then we immediately recover pp and qq in time O(𝖬(lgN))O(\operatorname{\mathsf{M}}(\lg N)).

The next few results are taken from the previous papers [Hit18] and [Har20].

Lemma 2.1.

Let n1n\geqslant 1 with n=O(N)n=O(N). Given as input v1,,vnNv_{1},\ldots,v_{n}\in\mathbb{Z}_{N}, we may compute the polynomial f(x)=(xv1)(xvn)N[x]f(x)=(x-v_{1})\cdots(x-v_{n})\in\mathbb{Z}_{N}[x] in time O(nlg3N)O(n\lg^{3}N).

Proof.

This is exactly [Har20, Lem. 2.3]; the proof depends on a standard application of a product tree. By “compute a polynomial” we mean compute a list of its coefficients. ∎

Remark 2.2.

In the above lemma, the hypothesis “n=O(N)n=O(N)” means that for every constant C>0C>0, the lemma holds for all nn and NN in the region n<CNn<CN, where the implied big-OO constant in the target bound O(nlg3N)O(n\lg^{3}N) may depend on CC. For the rest of the paper, a similar remark applies whenever we use the big-OO notation in this way.

Lemma 2.3.

Given as input an element αN\alpha\in\mathbb{Z}_{N}^{*}, positive integers n,κ=O(N)n,\kappa=O(N), and fN[x]f\in\mathbb{Z}_{N}[x] of degree nn, we may compute f(1),f(α),,f(ακ1)Nf(1),f(\alpha),\ldots,f(\alpha^{\kappa-1})\in\mathbb{Z}_{N} in time O((n+κ)lg2N)O((n+\kappa)\lg^{2}N).

Proof.

This is exactly [Har20, Lem. 2.4]. The proof relies on Bluestein’s algorithm [Blu70], which saves a logarithmic factor over a general multipoint evaluation. ∎

Lemma 2.4.

Given as input an integer N2N\geqslant 2 such that NN is either a prime or semiprime pqpq, and integers a,b,ua,b,u with at most O(lgN)O(\lg N) bits, we may test if uu is of the form aq+bpaq+bp, and if so recover pp and qq, in time O(lgNlglgN)O(\lg N\lg\lg N).

Proof.

This is a trivial modification of [Har20, Lem. 3.1]. The proof depends on observing that aqaq and bpbp must be roots of the polynomial y2uy+abNy^{2}-uy+abN. ∎

Lemma 2.5.

There is an algorithm with the following properties. It takes as input integers N2N\geqslant 2 and DD such that N2/5DNN^{2/5}\leqslant D\leqslant N. It returns either some βN\beta\in\mathbb{Z}_{N}^{*} with ordN(β)>D\operatorname{ord}_{N}(\beta)>D, or a nontrivial factor of NN, or “NN is prime”. Its runtime is bounded by

O(D1/2lg2N(lglgD)1/2).O\left(\frac{D^{1/2}\lg^{2}N}{(\lg\lg D)^{1/2}}\right).
Proof.

This is exactly [Hit18, Thm. 6.3]. Briefly, the idea is to attempt to compute orders of various αN\alpha\in\mathbb{Z}_{N}^{*} via the standard babystep-giantstep procedure. If we fail to compute ordN(α)\operatorname{ord}_{N}(\alpha), then the order must be large and we are done. If we succeed in computing kordN(α)k\coloneqq\operatorname{ord}_{N}(\alpha), then we try to find a factor of NN via gcd(N,αk/r1)\gcd(N,\alpha^{k/r}-1) for each prime divisor rr of kk. If this fails, then we know that kp1k\mid{p-1} for every prime divisor pp of NN. Repeating this process for various α\alpha, we either find an element of large order, or obtain enough information about the factorisation of p1p-1 for pNp\mid N to make it feasible to factor NN directly. For details, see [Hit18]. ∎

We will need the following well-known results on the distribution of primes.

Lemma 2.6.

For BB\to\infty we have

2rBr primelogr=(1+o(1))B,2rBr primer1r=Θ(1lgB).\sum_{\begin{subarray}{c}2\leqslant r\leqslant B\\ \text{\rm$r$ prime}\end{subarray}}\log r=(1+o(1))B,\qquad\prod_{\begin{subarray}{c}2\leqslant r\leqslant B\\ \text{\rm$r$ prime}\end{subarray}}\frac{r-1}{r}=\Theta\Big{(}\frac{1}{\lg B}\Big{)}.
Proof.

See Theorem 6.9 and Theorem 2.7(e) in [MV07]. The first statement is a form of the Prime Number Theorem, and the second statement is one of Mertens’ theorems. ∎

Finally we recall that a list of n1n\geqslant 1 elements of bit size β1\beta\geqslant 1 may be sorted using the “merge sort” algorithm in time O(nβlgn)O(n\beta\lg n) [Knu98]. Here we assume that the elements belong to some totally ordered set, and that we may compare a pair of elements in time O(β)O(\beta).

3. A variant of Lehman’s result

The crux of the algorithms of [Hit20] and [Har20] is the observation, going back to Lehman [Leh74], that if N=pqN=pq is semiprime, then there exist “small” integers aa and bb such that aq+bpaq+bp is “close” to (4abN)1/2(4abN)^{1/2} (see [Har20, Lem. 3.3], or the main theorem of [Leh74]). In this section we prove a variant of this result in which we impose an additional constraint on aa and bb of the form aqbp=0(modm)aq-bp=0\pmod{m}, where mm is a positive integer. (In Section 4 we will specialise to the case that mm is a product of small primes.) Moreover, instead of just an existence statement, we actually want to compute the desired aa and bb.

We recall some basic facts about lattices in 2\mathbb{R}^{2}. By a lattice we mean a subgroup of 2\mathbb{R}^{2} generated by two linearly independent vectors u,v2u,v\in\mathbb{R}^{2}, i.e., the subgroup u,v{ru+sv:r,s}2\langle u,v\rangle\coloneqq\{ru+sv:r,s\in\mathbb{Z}\}\subseteq\mathbb{R}^{2}. The determinant of a lattice LL is the area of the fundamental parallelogram associated to any basis for LL. In particular for L=u,vL=\langle u,v\rangle we have

detL=|det(u1v1u2v2)|.\det L=\left|\det\begin{pmatrix}u_{1}&v_{1}\\ u_{2}&v_{2}\end{pmatrix}\right|.

For a vector u2u\in\mathbb{R}^{2} we write u(u12+u22)1/2\lVert u\rVert\coloneqq(u_{1}^{2}+u_{2}^{2})^{1/2} for the usual Euclidean norm.

Lemma 3.1.

Let B2B\geqslant 2, and suppose we are given as input linearly independent vectors u,v2u,v\in\mathbb{Z}^{2} defining a lattice L=u,vL=\langle u,v\rangle, such that u,vB\lVert u\rVert,\lVert v\rVert\leqslant B. Then in time O(log3B)O(\log^{3}B) we may find a nonzero vector wLw\in L such that w2(detL)1/2\lVert w\rVert\leqslant 2(\det L)^{1/2}.

Proof.

We may find a nonzero vector wLw\in L of minimal norm by applying the classical Lagrange–Gauss reduction algorithm to the input basis (see [Gal12, Chap. 17]). According to [Gal12, Thm. 17.1.10], this runs in time O(log3B)O(\log^{3}B). (The reduction algorithm is essentially a special case of LLL: the basic idea is to repeatedly subtract a suitable integer multiple of the shorter vector from the longer vector, until no further progress can be made in reducing the norms.) This vector satisfies w2γ2detL\lVert w\rVert^{2}\leqslant\gamma_{2}\det L where γ2=2/3\gamma_{2}=2/\sqrt{3} is the Hermite constant for rank-22 lattices (see [Gal12, Defn. 16.2.7]). Since γ21/2=1.074<2\gamma_{2}^{1/2}=1.074\ldots<2 we are done. ∎

Remark 3.2.

Lemma 3.1 can be improved slightly. Minkowski’s convex body theorem [Lan94, §V.3, Thm. 3] implies that there exists a nonzero vector wLw\in L such that |w1|,|w2|(detL)1/2|w_{1}|,|w_{2}|\leqslant(\det L)^{1/2}, and such a vector can be found efficiently by a more involved algorithm; see for example [KS96]. This leads to better constants later in the paper, but does not affect our main asymptotic results.

Proposition 3.3.

There exists an algorithm with the following properties.

It takes as input positive integers N2N\geqslant 2, m0m_{0} and σ0\sigma_{0}, a positive integer mm coprime to NN, and an integer σ\sigma coprime to mm such that 1σm1\leqslant\sigma\leqslant m.

Its output is a pair of integers (a,b)(0,0)(a,b)\neq(0,0), such that if N=pqN=pq is a semiprime satisfying

σ0p<(1+1m0)σ0\sigma_{0}\leqslant p<\left(1+\frac{1}{m_{0}}\right)\sigma_{0} (3.1)

and

pσ(modm),p\equiv\sigma\pmod{m}, (3.2)

then the linear combination aq+bpaq+bp satisfies

|aq+bp(aNσ0+bσ0)|4N1/2m1/2m03/2\displaystyle\left|aq+bp-\left(a\frac{N}{\sigma_{0}}+b\sigma_{0}\right)\right|\leqslant\frac{4N^{1/2}m^{1/2}}{m_{0}^{3/2}} (3.3)

and

aq+bpaNσ+bσ(modm2).\displaystyle aq+bp\equiv a\frac{N}{\sigma}+b\sigma\pmod{m^{2}}. (3.4)

Assuming that m0,σ0,m=O(N)m_{0},\sigma_{0},m=O(N), the algorithm runs in O(lg3N)O(\lg^{3}N) bit operations, and moreover the output satisfies |a|,|b|=O(N2)|a|,|b|=O(N^{2}).

Proof.

Assume that the input parameters NN, m0m_{0}, σ0\sigma_{0}, mm and σ\sigma are as described above. Assume also that N=pqN=pq is a semiprime satisfying (3.1) and (3.2).

Let t0p/σ01t_{0}\coloneqq p/\sigma_{0}-1 so that p=σ0(1+t0)p=\sigma_{0}(1+t_{0}). Then 0t0<1/m010\leqslant t_{0}<1/m_{0}\leqslant 1, so

q=Np=Nσ0(1+t0)1=Nσ0(1t0+δt02)q=\frac{N}{p}=\frac{N}{\sigma_{0}}(1+t_{0})^{-1}=\frac{N}{\sigma_{0}}(1-t_{0}+\delta t_{0}^{2})

for some δ[0,1)\delta\in[0,1). For any pair of integers (a,b)(a,b), it then follows that

aq+bp=(aNσ0+bσ0)+t0(aNσ0+bσ0)+t02(δaNσ0).aq+bp=\left(a\frac{N}{\sigma_{0}}+b\sigma_{0}\right)+t_{0}\left(-a\frac{N}{\sigma_{0}}+b\sigma_{0}\right)+t_{0}^{2}\left(\delta a\frac{N}{\sigma_{0}}\right). (3.5)

Similarly, let tp/σ1t\coloneqq p/\sigma-1, so that p=σ(1+t)p=\sigma(1+t). Then tt is a rational number that is mm-integral (i.e., its denominator is coprime to mm), and t0(modm)t\equiv 0\pmod{m}. Thus

q=Np=Nσ(1+t)1Nσ(1t)(modm2),q=\frac{N}{p}=\frac{N}{\sigma}(1+t)^{-1}\equiv\frac{N}{\sigma}(1-t)\pmod{m^{2}},

and for any pair of integers (a,b)(a,b) we obtain

aq+bp(aNσ+bσ)+t(aNσ+bσ)(modm2).aq+bp\equiv\left(a\frac{N}{\sigma}+b\sigma\right)+t\left(-a\frac{N}{\sigma}+b\sigma\right)\pmod{m^{2}}.

This last congruence implies that (3.4) holds for any (a,b)(a,b) that satisfies

aNσ+bσ0(modm).-a\frac{N}{\sigma}+b\sigma\equiv 0\pmod{m}. (3.6)

If (a,b)(a,b) additionally satisfies the inequalities

|aNσ0+bσ0|2N1/2m1/2m01/2,|aNσ0|2N1/2m1/2m01/2,\left|-a\frac{N}{\sigma_{0}}+b\sigma_{0}\right|\leqslant\frac{2N^{1/2}m^{1/2}}{m_{0}^{1/2}},\qquad\left|a\frac{N}{\sigma_{0}}\right|\leqslant 2N^{1/2}m^{1/2}m_{0}^{1/2}, (3.7)

then (3.5) implies that (3.3) holds. We are left with showing how to compute a pair (a,b)(0,0)(a,b)\neq(0,0) satisfying both (3.6) and (3.7). (The point is that both of these conditions are independent of pp.)

The congruence (3.6) is equivalent to bγa(modm)b\equiv\gamma a\pmod{m}, where γ\gamma is the unique integer in [0,m)[0,m) congruent to N/σ2N/\sigma^{2} modulo mm. Thus the solutions (a,b)2(a,b)\in\mathbb{Z}^{2} to (3.6) form a lattice L=u,vL=\langle u,v\rangle, where u(1,γ)u\coloneqq(1,\gamma) and v(0,m)v\coloneqq(0,m). Our goal is to find a nonzero vector (a,b)L(a,b)\in L that lies in the parallelogram defined by (3.7).

To achieve this, it is convenient to introduce the linear change of variables

cNa,d(Nm0)a+(m0σ02)b.c\coloneqq Na,\qquad d\coloneqq(-Nm_{0})a+(m_{0}\sigma_{0}^{2})b.

In the (c,d)(c,d)-coordinates the inequalities (3.7) become simply

|c|,|d|2N1/2m1/2m01/2σ0,|c|,|d|\leqslant 2N^{1/2}m^{1/2}m_{0}^{1/2}\sigma_{0}, (3.8)

i.e., the parallelogram becomes a square. Moreover, in the (c,d)(c,d)-coordinates the lattice LL gets mapped to the lattice Lu,vL^{\prime}\coloneqq\langle u^{\prime},v^{\prime}\rangle where

u(NNm0+m0σ02γ),v(0m0σ02m).u^{\prime}\coloneqq\begin{pmatrix}N\\ -Nm_{0}+m_{0}\sigma_{0}^{2}\gamma\end{pmatrix},\qquad v^{\prime}\coloneqq\begin{pmatrix}0\\ m_{0}\sigma_{0}^{2}m\end{pmatrix}.

The determinant of LL^{\prime} is Nmm0σ02Nmm_{0}\sigma_{0}^{2}. We may therefore apply Lemma 3.1 to the basis u,vu^{\prime},v^{\prime} to find a nonzero pair (c,d)L(c,d)\in L^{\prime} satisfying (3.8).

The hypothesis m0,σ0,m=O(N)m_{0},\sigma_{0},m=O(N) implies that u,v=O(N4)\lVert u^{\prime}\rVert,\lVert v^{\prime}\rVert=O(N^{4}), so the cost of applying Lemma 3.1 is O(lg3N)O(\lg^{3}N). The cost of the remaining arithmetic (computing γ\gamma, uu^{\prime} and vv^{\prime}, and recovering (a,b)(a,b) from (c,d)(c,d)) is bounded by (lgN)1+o(1)(\lg N)^{1+o(1)}. Finally, (3.7) implies that |a|2N1/2m1/2m01/2=O(N1/2)|a|\leqslant 2N^{-1/2}m^{1/2}m_{0}^{1/2}=O(N^{1/2}) and |b|2N1/2m1/2+|a|N=O(N3/2)|b|\leqslant 2N^{1/2}m^{1/2}+|a|N=O(N^{3/2}). ∎

Remark 3.4.

The special case m=1m=1 of Proposition 3.3 is closely related to [Har20, Lem. 3.3] and the main theorem of [Leh74] (note that our parameter m0m_{0} roughly corresponds to rr in those statements), and in fact it is possible to prove those results using a similar lattice-based approach.

4. The main algorithm

For the convenience of the reader, we recall the following algorithm from [Har20], which forms a key subroutine of the main search algorithm presented afterwards.

Algorithm 4.1 (Finding collisions modulo pp or qq).

Input:

  • A positive integer NN, either prime or semiprime.

  • A positive integer κ\kappa, and an element αN\alpha\in\mathbb{Z}_{N}^{*} such that ordN(α)κ\operatorname{ord}_{N}(\alpha)\geqslant\kappa.

  • Elements v1,vnNv_{1}\ldots,v_{n}\in\mathbb{Z}_{N} for some positive integer nn, such that vhαiv_{h}\neq\alpha^{i} for all h{1,,n}h\in\{1,\ldots,n\} and i{0,,κ1}i\in\{0,\ldots,\kappa-1\}.

Output:

  • If N=pqN=pq is semiprime, and if there exists h{1,,n}h\in\{1,\ldots,n\} such that vhαi(modp)v_{h}\equiv\alpha^{i}\pmod{p} or vhαi(modq)v_{h}\equiv\alpha^{i}\pmod{q} for some i{0,,κ1}i\in\{0,\ldots,\kappa-1\}, returns pp and qq.

  • Otherwise returns “no factors found”.

1:Using Lemma 2.1 (product tree), compute the polynomial
f(x)(xv1)(xvn)N[x].f(x)\coloneqq(x-v_{1})\cdots(x-v_{n})\in\mathbb{Z}_{N}[x].
2:Using Lemma 2.3 (Bluestein’s algorithm), compute the values f(αi)Nf(\alpha^{i})\in\mathbb{Z}_{N} for i=0,,κ1i=0,\ldots,\kappa-1.
3:for i=0,,κ1i=0,\ldots,\kappa-1 do
4:     Compute γigcd(N,f(αi))\gamma_{i}\coloneqq\gcd(N,f(\alpha^{i})).
5:     if γi{1,N}\gamma_{i}\notin\{1,N\} then recover pp and qq and return.      
6:     if γi=N\gamma_{i}=N then
7:         for h=1,,nh=1,\ldots,n do
8:              if gcd(N,vhαi)1\gcd(N,v_{h}-\alpha^{i})\neq 1 then recover pp and qq and return.                             
9:Return “no factors found”.
Proposition 4.2.

Algorithm 4.1 is correct. Assuming that κ,n=O(N)\kappa,n=O(N), its running time is O(nlg3N+κlg2N)O(n\lg^{3}N+\kappa\lg^{2}N).

Proof.

This is exactly Proposition 4.1 in [Har20]. ∎

We now present the main search algorithm.

Algorithm 4.3 (The main search).

Input:

  • A positive integer N2N\geqslant 2, either prime or semiprime.

  • Positive integers m0m_{0} and mm such that gcd(m,N)=1\gcd(m,N)=1.

  • An element βN\beta\in\mathbb{Z}_{N}^{*} such that ordN(βm2)2λ+1\operatorname{ord}_{N}(\beta^{m^{2}})\geqslant 2\lambda+1 where

    λ4N1/2(mm0)3/2.\lambda\coloneqq\left\lceil\frac{4N^{1/2}}{(m\cdot m_{0})^{3/2}}\right\rceil.

Output: If N=pqN=pq is semiprime, returns pp and qq. Otherwise returns “NN is prime”.

1:for i=0,,2λi=0,\ldots,2\lambda do \triangleright Computation of babysteps
2:     Compute βm2i(modN)\beta^{m^{2}i}\pmod{N}.
3:     if gcd(N,βm2i1){1,N}\gcd(N,\beta^{m^{2}i}-1)\notin\{1,N\} then recover pp and qq and return.      
4:for σ=1,,m\sigma=1,\ldots,m do \triangleright Computation of giantsteps
5:     if gcd(σ,m)=1\gcd(\sigma,m)=1 then
6:         Initialise σ01\sigma_{0}\coloneqq 1.
7:         while σ0<N1/2\sigma_{0}<N^{1/2} do
8:              Apply Proposition 3.3 with input NN, m0m_{0}, σ0\sigma_{0}, mm and σ\sigma,                to obtain a pair (a,b)=(aσ,σ0,bσ,σ0)(a,b)=(a_{\sigma,\sigma_{0}},b_{\sigma,\sigma_{0}}).
9:               Compute
jσ,σ0m2(τ0λ)+τ,j_{\sigma,\sigma_{0}}\coloneqq m^{2}(\tau_{0}-\lambda)+\tau,
               where
τ0(aNσ0+bσ0)/m2,\tau_{0}\coloneqq\left\lfloor\left(a\frac{N}{\sigma_{0}}+b\sigma_{0}\right)\Big{/}m^{2}\right\rfloor,
               and where τ\tau is the unique integer such that
τaNσ+bσ(modm2),0τ<m2.\tau\equiv a\frac{N}{\sigma}+b\sigma\pmod{m^{2}},\qquad 0\leqslant\tau<m^{2}.
10:              Compute
vσ,σ0βaN+bjσ,σ0(modN).v_{\sigma,\sigma_{0}}\coloneqq\beta^{aN+b-j_{\sigma,\sigma_{0}}}\pmod{N}.
11:              Update σ0(1+1/m0)σ0\sigma_{0}\coloneqq\lceil(1+1/m_{0})\sigma_{0}\rceil.               
12:Applying a sort-and-match algorithm to the babysteps and giantsteps computed in Steps 2 and 10, find all i{0,,2λ}i\in\{0,\ldots,2\lambda\} and all pairs (σ,σ0)(\sigma,\sigma_{0}) such that
βm2ivσ,σ0(modN).\beta^{m^{2}i}\equiv v_{\sigma,\sigma_{0}}\pmod{N}. (4.1)
For each such match, apply Lemma 2.4 to the candidate
um2i+jσ,σ0,u\coloneqq m^{2}i+j_{\sigma,\sigma_{0}}, (4.2)
together with aaσ,σ0a\coloneqq a_{\sigma,\sigma_{0}} and bbσ,σ0b\coloneqq b_{\sigma,\sigma_{0}}. If pp and qq are found, return.
13:Let v1,,vnv_{1},\ldots,v_{n} be the list of giantsteps vσ,σ0v_{\sigma,\sigma_{0}} computed in Step 10, skipping those that were discovered in Step 12 to be equal to one of the babysteps. Apply Algorithm 4.1 (finding collisions) with NN, κ2λ+1\kappa\coloneqq 2\lambda+1, αβm2(modN)\alpha\coloneqq\beta^{m^{2}}\pmod{N} and v1,,vnv_{1},\ldots,v_{n} as inputs. If Algorithm 4.1 succeeds, return pp and qq.
14:Return “NN is prime”.
Proposition 4.4.

Algorithm 4.3 is correct. If m,m0=O(N)m,m_{0}=O(N), then it runs in time

O(mlgN(lglgN)2+ϕ(m)m0lg4N+N1/2lg2N(mm0)3/2).O\left(m\lg N(\lg\lg N)^{2}+\phi(m)m_{0}\lg^{4}N+\frac{N^{1/2}\lg^{2}N}{(m\cdot m_{0})^{3/2}}\right). (4.3)
Proof.

We first prove correctness. Suppose that N=pqN=pq is semiprime, with p<qp<q. We must show that in Steps 1–13 the algorithm succeeds in finding pp and qq.

Consider the loop in Steps 13. Since we have assumed that ordN(βm2)2λ+1\operatorname{ord}_{N}(\beta^{m^{2}})\geqslant 2\lambda+1, in this loop we either find a factor of NN, or prove that both ordp(βm2)2λ+1\operatorname{ord}_{p}(\beta^{m^{2}})\geqslant 2\lambda+1 and ordq(βm2)2λ+1\operatorname{ord}_{q}(\beta^{m^{2}})\geqslant 2\lambda+1. For the remainder of the proof, we will assume the latter.

We next consider the giantsteps. The block in Steps 810 is executed for various pairs (σ,σ0)(\sigma,\sigma_{0}). We claim that (3.2) holds for exactly one such σ\sigma, and that (3.1) holds for exactly one such σ0\sigma_{0}. For (3.2) this is clear, as pp is coprime to mm by hypothesis, so there is exactly one σ\sigma visited by the outer loop such that gcd(σ,m)=1\gcd(\sigma,m)=1 and pσ(modm)p\equiv\sigma\pmod{m}. For the inner loop, observe that σ0\sigma_{0} strictly increases on each iteration (in Step 11), so the loop certainly terminates. For any σ0\sigma_{0} visited in the loop, write σ0(1+1/m0)σ0\sigma^{\prime}_{0}\coloneqq\lceil(1+1/m_{0})\sigma_{0}\rceil for the value of σ0\sigma_{0} at the next iteration. Since p<N1/2p<N^{1/2}, on some iteration we must have σ0p<σ0\sigma_{0}\leqslant p<\sigma^{\prime}_{0}; in fact, this occurs for precisely one value of σ0\sigma_{0} because the successive intervals [σ0,σ0)[\sigma_{0},\sigma^{\prime}_{0}) are disjoint. Moreover, since pp is an integer, the condition σ0p<σ0\sigma_{0}\leqslant p<\sigma^{\prime}_{0} is equivalent to σ0p<(1+1/m0)σ0\sigma_{0}\leqslant p<(1+1/m_{0})\sigma_{0}, i.e., to (3.1). Therefore (3.1) holds for exactly one σ0\sigma_{0} as claimed.

Let (σ¯,σ¯0)(\bar{\sigma},\bar{\sigma}_{0}) be the pair for which (3.1) and (3.2) hold, and consider the corresponding coefficients a¯aσ¯,σ¯0\bar{a}\coloneqq a_{\bar{\sigma},\bar{\sigma}_{0}} and b¯bσ¯,σ¯0\bar{b}\coloneqq b_{\bar{\sigma},\bar{\sigma}_{0}} computed in Step 8. According to Proposition 3.3, the linear combination a¯q+b¯p\bar{a}q+\bar{b}p satisfies (3.3) and (3.4) for (σ¯,σ¯0)(\bar{\sigma},\bar{\sigma}_{0}). Let τ\tau and τ0\tau_{0} be as defined in Step 9. From (3.4) we find that

a¯q+b¯p=m2a¯q+b¯pm2+τ,\bar{a}q+\bar{b}p=m^{2}\left\lfloor\frac{\bar{a}q+\bar{b}p}{m^{2}}\right\rfloor+\tau, (4.4)

and (3.3) yields

a¯N/σ¯0+b¯σ¯0m24N1/2(mm0)3/2a¯q+b¯pm2a¯N/σ¯0+b¯σ¯0m2+4N1/2(mm0)3/2,\frac{\bar{a}N/\bar{\sigma}_{0}+\bar{b}\bar{\sigma}_{0}}{m^{2}}-\frac{4N^{1/2}}{(m\cdot m_{0})^{3/2}}\leqslant\frac{\bar{a}q+\bar{b}p}{m^{2}}\leqslant\frac{\bar{a}N/\bar{\sigma}_{0}+\bar{b}\bar{\sigma}_{0}}{m^{2}}+\frac{4N^{1/2}}{(m\cdot m_{0})^{3/2}},

so

τ0λa¯q+b¯pm2<(τ0+1)+λ.\tau_{0}-\lambda\leqslant\frac{\bar{a}q+\bar{b}p}{m^{2}}<(\tau_{0}+1)+\lambda.

This implies that τ0λ(a¯q+b¯p)/m2τ0+λ\tau_{0}-\lambda\leqslant\lfloor(\bar{a}q+\bar{b}p)/m^{2}\rfloor\leqslant\tau_{0}+\lambda, i.e., that (a¯q+b¯p)/m2=τ0λ+i¯\lfloor(\bar{a}q+\bar{b}p)/m^{2}\rfloor=\tau_{0}-\lambda+\bar{i} for some 0i¯2λ0\leqslant\bar{i}\leqslant 2\lambda. Inserting this into (4.4), we find that

a¯q+b¯p=m2i¯+j¯,\bar{a}q+\bar{b}p=m^{2}\bar{i}+\bar{j},

where j¯jσ¯,σ¯0\bar{j}\coloneqq j_{\bar{\sigma},\bar{\sigma}_{0}} is as defined in Step 9. Now, the congruence p1(modp1)p\equiv 1\pmod{p-1} implies that a¯q+b¯pa¯N+b¯(modp1)\bar{a}q+\bar{b}p\equiv\bar{a}N+\bar{b}\pmod{p-1}, so Fermat’s little theorem yields

βa¯q+b¯pβa¯N+b¯(modp).\beta^{\bar{a}q+\bar{b}p}\equiv\beta^{\bar{a}N+\bar{b}}\pmod{p}.

We conclude that there must be a collision modulo pp between the babysteps computed in Step 2 and the giantsteps computed in Step 10, namely

βm2i¯vσ¯,σ¯0(modp).\beta^{m^{2}\bar{i}}\equiv v_{\bar{\sigma},\bar{\sigma}_{0}}\pmod{p}. (4.5)

In Step 12, we attempt to find the solution (i¯,σ¯,σ¯0)(\bar{i},\bar{\sigma},\bar{\sigma}_{0}) to (4.5), by finding all solutions to the stronger congruence (4.1), which is a congruence modulo NN rather than modulo pp. Let (i,σ,σ0)(i,\sigma,\sigma_{0}) be one of the solutions found in Step 12. If it is equal to (i¯,σ¯,σ¯0)(\bar{i},\bar{\sigma},\bar{\sigma}_{0}), then the corresponding uu defined in (4.2) will be equal to m2i¯+j¯=a¯q+b¯pm^{2}\bar{i}+\bar{j}=\bar{a}q+\bar{b}p, and the factors pp and qq will be found via Lemma 2.4. Now suppose instead that (i,σ,σ0)(i¯,σ¯,σ¯0)(i,\sigma,\sigma_{0})\neq(\bar{i},\bar{\sigma},\bar{\sigma}_{0}). We claim then that (σ,σ0)(σ¯,σ¯0)(\sigma,\sigma_{0})\neq(\bar{\sigma},\bar{\sigma}_{0}). Indeed, if (σ,σ0)=(σ¯,σ¯0)(\sigma,\sigma_{0})=(\bar{\sigma},\bar{\sigma}_{0}), then we would have

βm2i¯vσ¯,σ¯0=vσ,σ0βm2i(modp),\beta^{m^{2}\bar{i}}\equiv v_{\bar{\sigma},\bar{\sigma}_{0}}=v_{\sigma,\sigma_{0}}\equiv\beta^{m^{2}i}\pmod{p},

which implies that i¯=i\bar{i}=i due to the fact that 0i,i¯2λ0\leqslant i,\bar{i}\leqslant 2\lambda and ordp(βm2)2λ+1\operatorname{ord}_{p}(\beta^{m^{2}})\geqslant 2\lambda+1. This establishes the claim, and consequently the giantstep vσ¯,σ¯0v_{\bar{\sigma},\bar{\sigma}_{0}} remains among the candidates in the list v1,,vnv_{1},\ldots,v_{n} constructed in Step 13.

Finally we consider Step 13. The procedure in Step 12 ensures that all preconditions for Algorithm 4.1 are met. In addition, we have seen in the last paragraph that one of v1,,vnv_{1},\ldots,v_{n} is equal to vσ¯,σ¯0v_{\bar{\sigma},\bar{\sigma}_{0}}. Hence, Algorithm 4.1 will succeed in finding a nontrivial factor of NN.

If NN is prime, then Steps 1–13 will fail to find a nontrivial factor, and the algorithm will correctly return “NN is prime” in Step 14.

We now analyse the runtime complexity. To prepare for the loop in Steps 13 we first compute βm2(modN)\beta^{m^{2}}\pmod{N}; the cost of this step is

O(lgmlgNlglgN).O(\lg m\lg N\lg\lg N).

The loop itself computes at most κ2λ+1\kappa\coloneqq 2\lambda+1 products modulo NN and κ\kappa GCDs of integers bounded by NN, whose total cost is

O(κlgN(lglgN)2).O(\kappa\lg N(\lg\lg N)^{2}).

In Step 5 we compute mm GCDs of integers bounded by m=O(N)m=O(N), which costs

O(mlgN(lglgN)2).O(m\lg N(\lg\lg N)^{2}).

Now consider the inner loop over σ0\sigma_{0}. The ratio between values of σ0\sigma_{0} on successive iterations is at least 1+1/m01+1/m_{0}, so for each σ\sigma the number of iterations of the inner loop over σ0\sigma_{0} is at most

log(N1/2)log(1+1/m0)=O(m0lgN).\left\lceil\frac{\log(N^{1/2})}{\log(1+1/m_{0})}\right\rceil=O(m_{0}\lg N).

The number of σ\sigma considered is ϕ(m)\phi(m), so the block in Steps 811 executes altogether

O(ϕ(m)m0lgN)O(\phi(m)m_{0}\lg N)

times. Let us estimate the cost of each iteration of this block. The cost of the invocation of Proposition 3.3 in Step 8 is O(lg3N)O(\lg^{3}N). By hypothesis we have σ,m,m0=O(N)\sigma,m,m_{0}=O(N), certainly λ,σ0=O(N1/2)\lambda,\sigma_{0}=O(N^{1/2}), and Proposition 3.3 ensures that a,b=O(N2)a,b=O(N^{2}), so all quantities appearing in Step 9 have O(lgN)O(\lg N) bits. The cost of computing σ1(modm2)\sigma^{-1}\pmod{m^{2}} is therefore O(lgN(lglgN)2)O(\lg N(\lg\lg N)^{2}), and all other arithmetic operations required to compute τ\tau, τ0\tau_{0} and jσ,σ0j_{\sigma,\sigma_{0}} in Step 9 cost at most O(lgNlglgN)O(\lg N\lg\lg N) bit operations. Similarly, the exponent aN+bjσ,σ0aN+b-j_{\sigma,\sigma_{0}} (=NO(1)=N^{O(1)}) in Step 10 and the updated value of σ0\sigma_{0} in Step 11 are computed in time O(lgNlglgN)O(\lg N\lg\lg N). Finally, the modular exponentiation in Step 10 requires O(lgN)O(\lg N) multiplications modulo NN, plus possibly one inversion modulo NN if the exponent is negative, so its cost is O((lgN)2lglgN+lgN(lglgN)2)O((\lg N)^{2}\lg\lg N+\lg N(\lg\lg N)^{2}). We conclude that the block in Steps 811 runs in time O(lg3N)O(\lg^{3}N), and that the total over all iterations is

O(ϕ(m)m0lg4N).O(\phi(m)m_{0}\lg^{4}N).

In Step 12, we construct a list of pairs (βm2i,i)(\beta^{m^{2}i},i) of length κ\kappa, and a list of tuples (vσ,σ0,jσ,σ0,aσ,σ0,bσ,σ0)(v_{\sigma,\sigma_{0}},j_{\sigma,\sigma_{0}},a_{\sigma,\sigma_{0}},b_{\sigma,\sigma_{0}}) of length O(ϕ(m)m0lgN)O(\phi(m)m_{0}\lg N). From the bounds already mentioned, each item in these lists occupies O(lgN)O(\lg N) bits. We then use merge-sort to sort the lists by the first component of each tuple, which requires

O((κ+ϕ(m)m0lgN)lg2N)O((\kappa+\phi(m)m_{0}\lg N)\lg^{2}N)

bit operations. Each giantstep vσ,σ0v_{\sigma,\sigma_{0}} is equal to at most one babystep βm2i\beta^{m^{2}i}, because our assumption ordN(βm2)κ\operatorname{ord}_{N}(\beta^{m^{2}})\geqslant\kappa implies that the babysteps are all distinct. Matching the two sorted lists, we may hence find all matches in time

O((κ+ϕ(m)m0lgN)lgN).O((\kappa+\phi(m)m_{0}\lg N)\lg N).

Since there are at most κ\kappa such matches, the total cost for applying Lemma 2.4 in Step 12 is bounded by

O(κlgNlglgN).O(\kappa\lg N\lg\lg N).

Again, we note that the assumptions of Lemma 2.4 on the size of the candidates for aa, bb and uu are always satisfied. Finally, in Step 13 we apply Algorithm 4.1, whose complexity is

O(ϕ(m)m0lg4N+κlg2N).O(\phi(m)m_{0}\lg^{4}N+\kappa\lg^{2}N).

Combining the contributions from all steps, we obtain the overall bound

O(mlgN(lglgN)2+ϕ(m)m0lg4N+κlg2N).O(m\lg N(\lg\lg N)^{2}+\phi(m)m_{0}\lg^{4}N+\kappa\lg^{2}N).

The last term becomes

O((N1/2(mm0)3/2+1)lg2N)=O(N1/2lg2N(mm0)3/2)+O(lg2N).O\left(\left(\frac{N^{1/2}}{(m\cdot m_{0})^{3/2}}+1\right)\lg^{2}N\right)=O\left(\frac{N^{1/2}\lg^{2}N}{(m\cdot m_{0})^{3/2}}\right)+O(\lg^{2}N).

The final lg2N\lg^{2}N term is dominated by ϕ(m)m0lg4N\phi(m)m_{0}\lg^{4}N, completing the proof. ∎

Remark 4.5.

The ϕ(m)m0lg4N\phi(m)m_{0}\lg^{4}N term in Proposition 4.4 arises from two sources: finding short lattice vectors in order to compute aa and bb (Lemma 3.1), and the collision-finding step (Algorithm 4.1). In fact, the collision-finding step is the real bottleneck; with some effort the O(lg3N)O(\lg^{3}N) cost of Lemma 3.1 can be improved to (lgN)1+o(1)(\lg N)^{1+o(1)} [NSV11].

Finally we present the main factoring routine. In this algorithm, N0N_{0} is a constant that is chosen large enough to ensure that the proof of correctness works for all NN0N\geqslant N_{0}. In principle one could work out N0N_{0} explicitly, but we will not do so.

Algorithm 4.6 (Factoring (semi)primes).

Input: A positive integer NN0N\geqslant N_{0}, either prime or semiprime.

Output: If N=pqN=pq is semiprime, returns pp and qq. Otherwise returns “NN is prime”.

1:Compute
BlgN30,m2rBr primer,B\coloneqq\left\lfloor\frac{\lg N}{30}\right\rfloor,\qquad m\coloneqq\prod_{\begin{subarray}{c}2\leqslant r\leqslant B\\ \text{$r$ prime}\end{subarray}}r,
and
m0(N1/5(lglgN)2/5(lgN)4/5)/m.m_{0}\coloneqq\left\lceil\left(\frac{N^{1/5}(\lg\lg N)^{2/5}}{(\lg N)^{4/5}}\right)\Big{/}m\right\rceil.
If gcd(N,m){1,N}\gcd(N,m)\notin\{1,N\}, recover pp and qq and return.
2:Apply Theorem 2.5 with DN2/5D\coloneqq\lceil N^{2/5}\rceil. If any factors of NN are found, or if NN is proved to be prime, return. Otherwise, we obtain βN\beta\in\mathbb{Z}_{N}^{*} such that ordN(β)>D\operatorname{ord}_{N}(\beta)>D.
3:Run Algorithm 4.3 (the main search) with the given NN, β\beta, mm and m0m_{0}. Return the factors found, or “NN is prime”.
Proposition 4.7.

Algorithm 4.6 is correct (for suitable N0N_{0}), and it runs in time

O(N1/5lg16/5N(lglgN)3/5).O\left(\frac{N^{1/5}\lg^{16/5}N}{(\lg\lg N)^{3/5}}\right).
Proof.

We start by discussing the choice of mm in Step 1. By the Prime Number Theorem (see Lemma 2.6) we have m=e(1+o(1))Bm=e^{(1+o(1))B}. Since

B=logN30log2+O(1)=logN20.794+O(1),B=\frac{\log N}{30\log 2}+O(1)=\frac{\log N}{20.794\ldots}+O(1),

we find that for large NN,

N1/21<m<N1/20.N^{1/21}<m<N^{1/20}. (4.6)

We may compute mm by simply enumerating the primes up to BB and multiplying them together; this may be done in time BO(1)=(lgN)O(1)B^{O(1)}=(\lg N)^{O(1)}. The rest of Step 1 (computing BB, m0m_{0} and gcd(N,m)\gcd(N,m)) may also be carried out in time (lgN)O(1)(\lg N)^{O(1)}.

Step 2 runs in time

O(N1/5lg2N(lglgN)1/2),O\left(\frac{N^{1/5}\lg^{2}N}{(\lg\lg N)^{1/2}}\right),

which is negligible. Assume that we do not find factors of NN or prove NN prime. We then obtain βN\beta\in\mathbb{Z}_{N}^{*} such that ordN(β)>N2/5\operatorname{ord}_{N}(\beta)>N^{2/5}.

For the invocation of Algorithm 4.3 in Step 3, we must check the precondition ordN(βm2)2λ+1\operatorname{ord}_{N}(\beta^{m^{2}})\geqslant 2\lambda+1, where we recall that λ=4N1/2/(mm0)3/2\lambda=\lceil 4N^{1/2}/(m\cdot m_{0})^{3/2}\rceil. On one hand, (4.6) yields

ordN(βm2)ordN(β)m2>N2/5(N1/20)2=N3/10.\operatorname{ord}_{N}(\beta^{m^{2}})\geqslant\frac{\operatorname{ord}_{N}(\beta)}{m^{2}}>\frac{N^{2/5}}{(N^{1/20})^{2}}=N^{3/10}.

On the other hand, the definition of m0m_{0}, together with (4.6), implies that

m0mN1/5(lglgN)2/5(lgN)4/5,m_{0}\cdot m\asymp\frac{N^{1/5}(\lg\lg N)^{2/5}}{(\lg N)^{4/5}}, (4.7)

so

2λ+1=N1/2(N1/5+o(1))3/2=N1/5+o(1).2\lambda+1=\frac{N^{1/2}}{(N^{1/5+o(1)})^{3/2}}=N^{1/5+o(1)}.

Therefore certainly ordN(βm2)2λ+1\operatorname{ord}_{N}(\beta^{m^{2}})\geqslant 2\lambda+1 for large NN. We conclude that Step 3 succeeds in factoring NN or proving NN prime.

The hypotheses m,m0=O(N)m,m_{0}=O(N) of Proposition 4.4 are certainly satisfied, so the cost of Step 3 is given by (4.3). The first term of (4.3) is negligible thanks to (4.6). To estimate the second term, we note that Mertens’ theorem (Lemma 2.6) implies that

ϕ(m)m=2rBr primer1r=O(1logB)=O(1lglgN).\frac{\phi(m)}{m}=\prod_{\begin{subarray}{c}2\leqslant r\leqslant B\\ \text{\rm$r$ prime}\end{subarray}}\frac{r-1}{r}=O\Big{(}\frac{1}{\log B}\Big{)}=O\Big{(}\frac{1}{\lg\lg N}\Big{)}.

Using this estimate together with (4.7), it is easy to check that the second and third terms in (4.3) simplify to the desired bound O(N1/5(lgN)16/5/(lglgN)3/5)O(N^{1/5}(\lg N)^{16/5}/(\lg\lg N)^{3/5}), and hence our choice for the size of mm0m\cdot m_{0} balances the asymptotic contribution from these two terms. Taking into account the discussion in Section 1, this also completes the proof of Theorem 1.1. ∎

References

  • [BGS07] A. Bostan, P. Gaudry, and É. Schost, Linear recurrences with polynomial coefficients and application to integer factorization and Cartier-Manin operator, SIAM J. Comput. 36 (2007), no. 6, 1777–1806. MR 2299425 (2008a:11156)
  • [Blu70] L. I. Bluestein, A linear filtering approach to the computation of discrete Fourier transform, IEEE Transactions on Audio and Electroacoustics 18 (1970), no. 4, 451–455.
  • [BZ11] R. P. Brent and P. Zimmermann, Modern Computer Arithmetic, Cambridge Monographs on Applied and Computational Mathematics, vol. 18, Cambridge University Press, Cambridge, 2011. MR 2760886
  • [CH14] E. Costa and D. Harvey, Faster deterministic integer factorization, Math. Comp. 83 (2014), no. 285, 339–345. MR 3120593
  • [CP05] R. Crandall and C. Pomerance, Prime Numbers: a Computational Perspective, second ed., Springer, New York, 2005. MR 2156291 (2006a:11005)
  • [Gal12] S. D. Galbraith, Mathematics of Public Key Cryptography, Cambridge University Press, Cambridge, 2012. MR 2931758
  • [Har20] D. Harvey, An exponent one-fifth algorithm for deterministic integer factorisation, to appear in Mathematics of Computation, arXiv preprint https://arxiv.org/abs/2010.05450, 2020.
  • [Hit18] M. Hittmeir, A babystep-giantstep method for faster deterministic integer factorization, Math. Comp. 87 (2018), no. 314, 2915–2935. MR 3834692
  • [Hit20] by same author, A time-space tradeoff for Lehman’s deterministic integer factorization method, to appear in Mathematics of Computation, arXiv preprint http://arxiv.org/abs/2006.16729v1, 2020.
  • [HvdH21] D. Harvey and J. van der Hoeven, Integer multiplication in time O(nlogn)O(n\log n), Ann. of Math. (2) 193 (2021), no. 2, 563–617. MR 4224716
  • [Knu98] D. E. Knuth, The Art of Computer Programming. Vol. 3, Addison-Wesley, Reading, MA, 1998, Sorting and searching, Second edition [of MR0445948]. MR 3077154
  • [KS96] M. Kaib and C. P. Schnorr, The generalized Gauss reduction algorithm, J. Algorithms 21 (1996), no. 3, 565–578. MR 1417664
  • [Lan94] S. Lang, Algebraic Number Theory, second ed., Graduate Texts in Mathematics, vol. 110, Springer-Verlag, New York, 1994. MR 1282723
  • [Law95] F. W. Lawrence, Factorisation of numbers, Messenger of Math. 24 (1895), 100–109.
  • [Leh74] R. S. Lehman, Factoring large integers, Math. Comp. 28 (1974), 637–646. MR 340163
  • [Len00] A. K. Lenstra, Integer factoring, Des. Codes Cryptogr. 19 (2000), no. 2-3, 101–128, Towards a quarter-century of public key cryptography. MR 1758972
  • [MV07] H. L. Montgomery and R. C. Vaughan, Multiplicative Number Theory. I. Classical Theory, Cambridge Studies in Advanced Mathematics, vol. 97, Cambridge University Press, Cambridge, 2007. MR 2378655
  • [NSV11] A. Novocin, D. Stehlé, and G. Villard, An LLL-reduction algorithm with quasi-linear time complexity [extended abstract], STOC’11—Proceedings of the 43rd ACM Symposium on Theory of Computing, ACM, New York, 2011, pp. 403–412. MR 2931990
  • [Pap94] C. H. Papadimitriou, Computational Complexity, Addison-Wesley Publishing Company, Reading, MA, 1994. MR 1251285 (95f:68082)
  • [Rie94] H. Riesel, Prime Numbers and Computer Methods for Factorization, second ed., Progress in Mathematics, vol. 126, Birkhäuser Boston, Inc., Boston, MA, 1994. MR 1292250
  • [vzGG13] J. von zur Gathen and J. Gerhard, Modern Computer Algebra, 3rd ed., Cambridge University Press, Cambridge, 2013. MR 3087522
  • [Wag13] S. S. Wagstaff, Jr., The Joy of Factoring, Student Mathematical Library, vol. 68, American Mathematical Society, Providence, RI, 2013. MR 3135977