Factorization of numbers with Gauss sums: III. Algorithms with entanglement

We propose two algorithms to factor numbers using Gauss sums and entanglement: (i) in a Shor-like algorithm we encode the standard Gauss sum in one of two entangled states and (ii) in an interference algorithm we create a superposition of Gauss sums in the probability amplitudes of two entangled states. These schemes are rather efficient provided that there exists a fast algorithm that can detect a period of a function hidden in its zeros.


Introduction
Gauss sums, that are sums whose phases depend quadratically on the summation index, have periodicity properties that make them ideal tools to factor numbers.The crucial role of periodicity in the celebrated Shor algorithm has recently been identified and summarized by N. D. Mermin [1] in the statement "Quantum mechanics is connected to factoring through periodicity ... and a quantum computer provides an extremely efficient way to find periods".
In a series of papers [2,3] we have analyzed the possibilities of Gauss sums for factorization offered by their periodicity properties.Although our considerations were confirmed by numerous experiments [4] the schemes proposed so far scale exponentially since they do not envolve entanglement.In the present article we propose and investigate two algorithms which connect [5,6] Gauss sum factorization with entanglement.
Throughout our article, we consider two interacting quantum systems and describe them by two complete sets of states with discrete eigenvalues.We pursue two approaches: (i) we encode the absolute value of the standard Gauss sum in one of the two quantum states, and (ii) we create an interference of Gauss sums in the probability amplitudes of a quantum state.
Since our first algorithm is inspired by the one of Shor, we replace the modular exponentiation f used by Shor by a function g defined by the standard Gauss sum.However, there is a crucial difference between f and g: whereas every value of f is assumed in a period only once [1], the function g takes on the same value several times.In this case, the periodicity is stored in the zeros of a probability distribution.Moreover, this method is based on a very specific initial state which is unfortunately hard to realize.In order to avoid these complications, we encode in the second approach the Gauss sum in the probability amplitudes of the state rather than in the state itself.In this way we obtain a superposition of Gauss sums.
Our article is organized as followes: in Sec. 2 we combine the Shor algorithm with Gauss sum factorization by replacing the function f by the appropriately standard Gauss sum g.The discussion of this new algorithm leads in Sec. 3 to the idea of using entanglement to estimate the Gauss sum W (N ) n , which we then apply to factor numbers.We conclude in Sec. 4 by summarizing our results and presenting an outlook.

Shor algorithm with Gauss sum
In this section, we discuss a generalization of the Shor algorithm where the absolute value of an appropriately normalized standard Gauss sum replaces the modular exponentiation.For this purpose, we first analyze the periodicity properties of this function and then suggest an algorithm similar to Shor.Next, we investigate the factorization properties depending on the measurement outcome of the second system.We conclude with a brief discussion of the similarities and differences between the original Shor algorithm and our alternative proposal.

Periodicity properties of normalized standard Gauss sum
The Shor algorithm [7] contains two crucial ingredients: (i) the mathematical property that the function exhibits a period r, that is f (ℓ, N) = f (ℓ + r, N), and (ii) the quantum mechanical property that the Quantum Fourier Transform (QFT) is able to find the period of a function in an efficient way.However, we now show that it is possible to construct an algorithm similar to the one by Shor, by using the periods of other functions which also contain information about the factors of a given number N.An example is the function expressed in terms of the standard Gauss sum [8,9] G(ℓ, N) The properties of G provide us with the explicit form that is the function g is determined by the greatest common divisor (gcd) of N and ℓ.
We now analyze the periodicity properties of g for the two cases: (i) N consists of two, or (ii) more than two prime factors.However, if ℓ is also a multiple of N = 35 as marked by rectangles, the periodicity relation g(ℓ, N ) = g(ℓ + r, N ) does not hold anymore.

N consists of two prime factors
If N contains only the two prime factors p and q, the explicit value of the function g = g(ℓ, N) is given by As a consequence, g shows one perfect period r = N, where the identity g(ℓ, N) = g(ℓ + r, N) is valid for all arguments ℓ, and two imperfect periods r = p, q, where g(ℓ, N) = g(ℓ + r, N) is valid for allmost all arguments ℓ.This behavior of g is displayed in figure 1 for the example N = 35.Indeed, every argument ℓ of g which is a multiple of a factor p leads to a value of g equal to this factor.However, for arguments ℓ = k • N which are also multiples of N the function g yields g(k • N, N) = N, and therefore the periodicity relation g(ℓ, N) = g(ℓ + k • p, N) does not hold true for these arguments.
Furthermore, the imperfect periods given by the factors of N interrupt each other.For example, all arguments ℓ which are multiples of q do not satisfy the periodicity relation for the imperfect period r = p because the greatest common divisor of ℓ = sq and N is q (if s = k • p) and therefore g(s • q, N) = q. (6) However, the argument ℓ = s • q + k • p shares in general no factor with N. Therefore, we obtain Here, the imperfect periodicity at multiples of factors is interrupted for every ℓ, which shares more than one prime factor with N, such as ℓ = 30 = 2 • 3 • 5.However, these arguments ℓ form a new imperfect period given by gcd(ℓ, N) which in our example reads gcd(30, 105) = 15.This new imperfect period again contains information about the factors of N.
In the following sections, we will not distinguish between perfect periods and imperfect periods anymore, since the imperfection of the imperfect periods do not influence our proposed algorithms, as long as g(ℓ, N) = g(ℓ + r, N) is valid for most arguments ℓ.

Outline of algorithm
In the present section we introduce an algorithm which combines Gauss sums and entanglement and is constructed in complete analogy to the Shor algorithm.For the sake of simplicity we concentrate on numbers N with only two prime factors p and q.
Similar to Shor, we start with the entangled state of two systems A and B. However, in contrast to Shor we encode in system B the function g defined by (2) rather than f given by (1).The dimension of system A is chosen to be 2 Q because we want to realize this system with qbits.We will give a condition for the magnitude of Q in the next section.
In the second step, we perform a measurement on system B. For an integer N = p•q consisting only of the two prime factors p and q there exist three distinct measurement outcomes: (i) the number N to be factored, that is g(ℓ, N) = N, (ii) a factor of N, that is g(ℓ, N) = p or g(ℓ, N) = q, (iii) unity, that is g(ℓ, N) = 1.
In case (i), the state of system A after the measurement of B reads where the normalization constant and [x] denotes the smallest integer which is larger than x.
The state |ψ (N ) A shows a periodicity with period N, which does not help us to factor the number N. Therefore, we will have to repeat the first two steps of our algorithm until the measurement outcome differs from N. Fortunately, case (i) occurs only with the probability P (N ) B ≈ 1/N and is therefore not very likely.In case (ii), system A is in a superposition of all number states |ℓ A , which are multiples of the factor p of N, but not of N itself giving rise to where In this state, as depicted in figure 3 for the example N = 91 and p = 7, only multiples of p appear with a non-zero probability which leads to a clearly visible periodicity.However, the periodicity is imperfect at arguments ℓ = k • N, which are multiples of N. We emphasize that this case occurs with the probability P (p) B ≈ 1/p − 1/N and is therefore more likely than (i).In the third case, system A contains all numbers ℓ which are not multiples of one of the factors of N. As a consequence, the state reads A (ℓ; 91) to find |ℓ A in the state |ψ (7)  A for the example N = 91 = 7 • 13 and p = 7 in the range 1 ≤ ℓ ≤ 200.The probability is non-vanishing only for multiples of 7.However, multiples of 7 which are also multiples of N = 91 have a vanishing probability.As a consequence, the period of |ψ (7)  A is imperfect. with . Since all multiples of N are contained in the second as well as in the third sum we have subtracted them twice.Therefore, we have to add them once again.
The probability for this case is given by and takes on the smallest value around 1/2 for p = 2 and q = N/2, but tends to unity for prime factors p ≈ q ≈ √ N .As shown in figure 4, the state |ψ (1)  A exhibits perfect periodicity but every multiple of p and q has zero probability, whereas all other numbers are equally weighted.As a consequence, in this case the information about the factors is encoded in the "holes".

Analysis of periodicity
In the preceding section, we have found that the function g = g(ℓ, N) in its dependence on ℓ exhibits periods which contain information about the factors of N, but in some cases these periods are imperfect.We now analyze if it is possible to extract information about the periodicity of g with the help of a QFT defined by This procedure is analogous to the Shor algorithm.We distinguish two cases for the state of system A.
A (ℓ; 91) to find |ℓ A in the state |ψ (1)  A for the example N = 91 = 7 • 13 in the range 1 ≤ ℓ ≤ 100.The probability vanishes for all multiples of the factors 7 and 13.Here, periodicity even exists for multiples of N = 91.The probability is equal to N (1) −2 for all other arguments.

State of A contains only multiples of p The QFT transforms the state |ψ (p)
A given by ( 10) into with the definition As shown in Appendix A.1 the sum F (pm/2 Q ; M p ) leads to sharp peaks in the probability distribution These peaks will give us information about the factor p.
Unfortunately, the sum F (Nm/2 Q ; M N ) also leads to sharp peaks located at m N ≡ j2 Q /N + δ j .As a consequence, we need to calculate the probability P(p,p) A to find any m p and compare it to the probability P(p,N) A to measure any m N .In Appendix A.2, we obtain the estimates and As a consequence, we find that peaks at m p are enhanced compared to peaks at m N by the factor (N − p) 2 /p 2 ≈ q 2 .This fact is clearly visible in figure 5 for the example N = 91 = 7 • 13.The large frame shows the peaks located at m p .In the inset we magnify the probability distribution in the range 1 ≤ m ≤ 100.Here, also peaks at m N exist.However, they are approximately 13 2 times smaller.Furthermore, as verified in Appendix A.2 the total probability P(p,p) A to find any m p tends to 0.4 whereas the probability P(p,N) A to find any m N approaches zero.At last, we have to analyze the width of the probability distribution for estimating the minimal dimension 2 Q for an unique estimation of p from m p .Here, we follow the considerations of N. D. Mermin [1].
The measurement result m is within 1/2 of j • 2 Q /p and therefore Does there exist another combination j ′ /p ′ = j/p which lies within this range of m/2 Q ?The distance between these two pairs of numbers can be approximated by If both combinations would lie whithin 1/2 Q+1 of m/2 Q then their distance would be smaller than, or equal to 1/2 Q .Therefore, if 2 Q > N 2 , then their exists only one combination j • 2 Q /p which lies within 1/2 of m.For a graphical representation of this statement, we refer to figure 6.
. Graphical demonstration of the uniqueness of j/p.The ratio j/p must be within 1/2 Q+1 of m/2 Q .Every other combination j ′ /p ′ with j ′ /p ′ = j/p must differ at least 1/N 2 from j/p.Therefore, if N 2 < 2 Q then j ′ /p ′ cannot be within 1/2 Q+1 of m/2 Q , too.
We conclude by emphasizing that we can extract in 40% of the measurements the factor p of N. Furthermore, the imperfection of the periodicity does not influence the ability of the QFT to find the period p.

State of A does not contain any multiples of p or q
When we perform the QFT on the state |ψ (1)  A given by ( 12) we arrive at where we have recalled the definition of F from (16).As estimated in Appendix A.3, the peaks at m p and m q ≡ j • 2 Q /q + δ j are approximately q times, or p times higher than peaks at m N .However, they are smaller in comparison to case (ii), where the measured value of system B was equal to p.All these aspects are visible in figure 7 for the example N = 91 = 7 • 13.
The total probability to find any m p or m q is given by P(1,p or q) A = p P (1) A (m p ; N) + q P (1) as calculated in Appendix A.3.This probability tends to zero for large N with two prime factors which are of the order of √ N. As a consequence, it is not useful to try to find the period of |ψ (1)  A with a QFT.The periodicity of |ψ (1)  A is perfect, since the states corresponding to integer multiples of p and q are missing.Moreover,there exist many points with the same value.In contrast, in the Shor algorithm, every integer ℓ in the range 0 ≤ ℓ ≤ r − 1 yields [1] a different outcome of f , and therefore, we are able to find the period r with the help of a QFT.In our scheme there exist approximately p numbers ℓ in the range 0 ≤ ℓ ≤ p − 1 which lead to the same value of g.As a consequence, it is not possible anymore to find the period p with the help of a QFT.Nevertheless, the state |ψ (1)   A is remarkable, because the information about the factors of N is still endcoded in the periodicity.Since the QFT is not a good tool to find this period, we need to develop another instrument which extracts the information about the periodicity of |ψ (1)  A in an efficient way.

Discussion
In this section, we have analyzed a factorization algorithm constructed in complete analogy to the one by Shor but with the function g given by (2) instead of f determined by (1).Our approach combines the periodicity properties of Gauss sums with the QFT.Although we have found some rather encouraging results there are problems with this approach.Indeed, it is not possible to measure a period with the help of a QFT if there exists a large amount of arguments ℓ within one period were the function assumes the same value.As a consequence, the problem of our scheme is not the imperfection of the periodicity of g but the large number of arguments ℓ with g(ℓ, N) = 1.
Furthermore, we emphasize that the QFT for the case (ii) is not necessary.A measurement of the state |ψ (p) A , given by ( 10), itself will also give us the information about the period p.In contrast, the Shor algorithm relies on the state which contains not only the period r, but also the unknown variable ℓ 0 .Since it is not possible to extract r from an argument ℓ 0 + mr, the QFT is essential in the Shor algorithm.Furthermore, several runs of the Shor algorithm lead to different numbers ℓ 0 In summary, the modular exponentiation is not only special, because its period contains information about the factors of N, but also because every value appears only once [1] in a period.Moreover, we suspect that there may exist quantum algorithms, which find periods of a function in an efficient way despite the fact that nearly all arguments ℓ in one period assume the same value.This may be achieved for example A (m; 91) of system A conditioned on the measurement of system B with the result |1 B and the QFT for the example N = 91 = 7 • 13.Here, we have used a system of 11 qbits.Clearly visible are peaks at multiples of 2 11 /13 ≈ 157.5 and 2 11 /7 ≈ 292.4.The inset magnifies the range 1 ≤ n ≤ 100 where also peaks at multiples of 2 11 /91 ≈ 22.5 exist.However, they are approximately 13 2 times smaller than the peaks at multiples of 292.4.A comparison with figure 5 shows that all peaks are smaller than in the case (ii).
by a comparison of this periodic function with a function were all arguments assume the same value.Interferometry could archieve such a task.Here, two possibilities offer themselves: i) We can couple the systems A und B to an ancilla system and prepare the superposition by a Hadamard transform.However, in this case we are confronted with a probabilistic approach in the spirit of quantum state engineering [11].ii) In order to avoid small probabilities for the desired measurement outcomes we rather pursue an idea based on adiabatic passage, a technique that has already been used successfully in many situations of quantum optics to synthesize quantum states [12].

Algorithm based on a superposition of Gauss sums
In Sec. 2 we have discussed an algorithm inspired by the one of Shor [7] which uses the Gauss sum g instead of the modular exponentiation.However, we did not explain how to create the initial state |Ψ A,B defined by (8).Indeed, this task is quite complicated, because in general it is not possible to display and add in an exact way complex numbers of the form e iϕ with a finite amount of qbits.Therefore, we pursue in this section another approach where we encode g not in the states |ℓ B of system B but in their probability amplitudes.

Central idea
Encoding a Gauss sum in a probability amplitude of a quantum state was already done experimentally [4] for the truncated Gauss sum Moreover, the number M + 1 of terms of A (M ) N grows only polynomial with the number of digits of N, whereas for the standard Gauss sum G, defined by (3), it increases exponentially.Furthermore, we want to estimate G for several ℓ in parallel.For this reason, it is not useful to realize G experimentally by a pulse train, or in a ladder system or by interferometry as proposed in [3].
On the other hand, G has two major advantages compared to A (M ) N : (i) |G| 2 shows an enhanced signal not only at arguments ℓ = p but also at integer multiples of factors, and (ii) the signal at multiples of a factor is enhanced by the factor itself and not only by √ 2. As a consequence, for the state the probability to find the state |ℓ with ℓ being any multiple of a factor p is p times higher than finding |ℓ = k • p .The amount of arguments ℓ, which are not multiples of p, is approximatly p times higher than the amount of multiples of p.As a consequence, the product of the probability of finding ℓ = k • p times the amount of numbers ℓ = k • p with 0 ≤ ℓ ≤ N − 1 is approximately equal to the product of the probability of finding ℓ = k • p times the amount of numbers ℓ = k • p with 0 ≤ ℓ ≤ N − 1.Therefore, the probability to find any multiple of a factor is around 50%.As a result, we have found a fast factorization algorithm provided we are able to prepare the state |ψ defined in (27) in an efficient way.Unfortunately, this is not an easy task.On the other hand, we can use entanglement to calculate the sum which is very close to the standard Gauss sum G and shows similar properties.We therefore now propose an algorithm based on W (N ) n .

Algorithm
The idea of our algorithm is that system A is in a state of superposition of all trial factors ℓ and the summation in m in the Gauss sum W (N ) n is realized by a superposition of system B. Therefore, we start from the product state where the dimensions of the systems A and B are equal to the number N to be factored.Next, we produce phase factors of the form exp [2πim 2 ℓ/N]which appear in the Gauss sum W Here, nj denotes the number operator of the system j = A, B and N defines the periodicity of the phase.The operator Ûph entangles the two systems, and the state |Ψ 1 A,B of the combined system is now given by We emphasize, that the information about the Gauss sum is not stored in a single system, but in the phase relations between the two systems.Therefore, tracing out one system and applying a number state measurement on the other, or measuring the number states of both systems would not help us to estimate the Gauss sums W (N ) n .It would only show that all trial factors have equal weight.As a consequence, we have to perform local operations on the individual systems, which do not destroy the information inherent in the phase relations but help us to read out the Gauss sum.
Therefore, we perform as a second step a QFT, as defined in (14) on system B and the state of the complete system reads where W (N ) n (ℓ) denotes the Gauss sum defined in (28).This operation achieves two tasks: (i) the sum of quadratic phase terms is now independent of system B. For this reason, we are able to make a measurement on system B leaving the sum of the quadratic phase terms in tact; and (ii) in addition to them a second phase term which is linear in m arises.
After a measurement on system B with outcome |n 0 B , system A is in the quantum state The sum W (N ) n 0 is equivalent to G only for n 0 = 0. Nevertheless, W (N ) n (ℓ) shows properties which are similar to but not exactly the same as G(ℓ, N).Therefore, we have to investigate now the influence of n 0 on W (N ) n 0 .

Probability distribution of system A
In this section, we discuss the probability distribution of system A, provided the measurement result of system B is equal to n 0 , and analyze its factorization properties.Here, N denotes a normalization constant.Furthermore, we investigate how the measurement outcome n 0 of system B influences these properties.
From Appendix B we recall the result and recognize that there is a distinct difference between trial factors ℓ which share a common divisor with N and trial factors which do not.Depending on whether n 0 is (i) equal to zero, (ii) shares a common factor p with N, or (iii) shares no common divisor with N, the probability for factors and their multiples is much higher than for other trial factors, or equal to zero.In any case, it is possible to distinguish between factors and nonfactors.Now, we investigate the abilities of these three classes of probability distributions to factor the number N.
3.3.1.n 0 is equal to zero A special case occurs for n 0 = 0 where the probability distribution P (0) A (ℓ, N) is equal to the absolute value squared of the Gauss sum G(ℓ, N).It is the only case, where the probability P (n 0 ) A (ℓ = 0, N) is nonzero.Indeed, here it is N times larger than for trial factors, which do not share a common divisor with N.However, also in this case the probability to find a multiple of any factor p of N is p times larger compared to arguments which do not share a common factor with N. It is for this reason that the multiples of the factors p = 7 and 13 stand out in figure 8.
Important for the present discussion is not the probability for a given ℓ itself, but the probability P (0) A to find any multiple of a factor.Now, we assume that N contains only the two prime factors p and q = N/p.In this case, there exist N/p − 1 multiples of the factor p with the probability p/(4N − 2p − 2N/p + 1) and p − 1 multiples of the factor q = N/p with the probability (N/p)/(4N − 2p − 2N/p + 1).Therefore, P (0) A is given by A (ℓ; 91)to find the state |ℓ A in system A if we have measured before the state |n 0 = 0 B in system B.This probability distribution is proportional to The probability for ℓ = 0 is N = 91 times larger than for trial factors which do not share a common divisor with N .For arguments ℓ which are multiples of a factor p = 7 or 13 the probability is p = 7 or 13 times larger, respectively.
For large integers N we can neglect the term +1 in the denominator and arrive at the asymptotic behavior As a consequence, the probability to find any multiple of a factor tends for large N to 1/2 independent of the prime factors.Therefore, the probability distribution P (0) A (ℓ, N) is an excellent tool for factoring.
3.3.2.n 0 and N share a common divisor p If n 0 is a multiple of p with N = p • q the probability to find ℓ = k • p is p times larger than for other trial factors ℓ.But the probability to measure a multiple of q is equal to zero.This fact is clearly visible in figure 9 where we factor the number N = 91 = 7 • 13 with the help of P A (ℓ, 91).Because n 0 = 14 shares the common factor 7 with N = 91, all multiples of 7 have a probability that is 7 times larger than arguments which do not share a common factor.In contrast, the probability to obtain any multiple of 13 is still zero.
In order to derive the probability P to find any multiple of a factor we note that there exist N/p − 1 multiples of the factor p with probability p/(2N − 2p − N/p + 1) and arrive at This function is monotonically decreasing for 2 ≤ p ≤ N/2.Therefore, we get the smallest probability for the largest possible prime factor of N, which is N/2 and leads A (ℓ; 91) to find the state |ℓ A in the system A if we have measured before the state |n 0 = 14 B .This probability is proportional to |W (91) 14 | 2 .For ℓ being a multiple of 7 the probability is seven times larger than for other trial factors, but for the multiples of the factor 13, the probability vanishes, because n 0 = 14 is not a multiple of 13.
which for large N also tends to 1/2.As a consequence, the case n 0 = k • p displays a similar behavior as n 0 = 0: The probability P (k•p) A (ℓ, N) is also an excellent tool for factoring.
3.3.3.n 0 and N do not share a common divisor As shown in Fig. 10 the probability P (n 0 =k•p) A to find a multiple of a factor is equal to zero if n 0 and N do not share a common divisor.As a consequence, it is not possible to deduce the factors of N with a few measurements of the state of system A. Nevertheless, it should still be possible to extract the factors of N from P (n 0 =k•p) A , although at the moment we do not know how to perform this task in an efficient way.However, there exist proposals that encoding information in the zeros [10] of a function is better than encoding them in the maxima.Therefore, we suspect that there may exist an algorithm to obtain the information about the factors of N from the zeros of P (n 0 =k•p) A (ℓ, N).

Probability distribution of system B
In the preceding section we have found that the probability distribution of system A depends crucially on the measurement outcome n 0 of system B. Depending on whether n 0 is a multiple of a factor of N or not, system A shows a different behavior.Therefore, it is essential to investigate the probability distribution of system B for predicting the behavior of system A which constitutes the topic of the present section.
With the help of the quantum state (32) of the combined system the probability distribution for system B is given by From the explicit expression (35) for n (ℓ) we obtain the result if N is the product of the two prime numbers p and q.
An example for such a probability is depicted in figure 11, where we show P B (n, N) for the example N = 91 = 7 • 13.The probability to find a multiple of the two factors 7 and 13 is larger than for other trial factors.
However, we are not interested in the probability of a single n, but rather in the probability P (0 or k•p or k•q) B that n 0 is equal to zero, or a multiple of a factor, because in these two cases it is possible to efficiently extract the information about the factors of N. Since P (0 or k•p or k•q) B is given by the sum over all probabilities P B (n, N) where n falls into one of these cases that is we find with the help of (42) and q = N/p the expression The probability P (0 or k•p or k•q) B exhibits a minimum at p = √ N, where it is given by and it tends to zero for large N as the inverse of a square root.As a consequence, it is very unlikely that n 0 is equal to zero, or a multiple of a factor but it is highly probable that n 0 shares no common divisor with N. Unfortunately, in this case a rapid factorization based on our algorithm is only possible if we find an efficient way to extract the factors of N from P (n 0 =k•p) A .

Degree of entanglement
In Sec.3.2 we have mentioned that the information about factors is contained in the entanglement of the two systems A and B. Indeed, (35) suggests a strong correlation between the two systems.We now investigate the degree of entanglement [13,14] with the help of the purity of the reduced density operator ρi with i = A, B. For a product state the purity is equal to unity.On the other hand, the state is maximally entangled if µ = 1/D, where D denotes the dimension of the subsystem.We now derive an exact closed-form expression for µ.
The reduced density operator ρA of system A after the unitary transformation Ûph following from (30) reads which is independent of applying a QFT on system B or not.As a consequence, the purity of subsystem A can be reduced to and is given by the sum of the standard Gauss sum G(ℓ, N) over all test factors ℓ.Assuming that N only contains the two prime factors p and q = N/p, the purity can be written in a closed form which results from the following considerations.
that is The purity is maximal for p = √ N and tends in this case for large N to 4/N.The maximal value of purity is equal to the minimal degree of entanglement.Since the maximal purity is only 4/N and therefore very small, the two systems A and B are strongly entangled.

Realization with qbits
So far, we have not discussed the resources and the time necessary for our proposed algorithm.Both of them depend strongly on the underlying physical systems.For example, we can use two light modes for the two systems A and B and the most appropriate states are photon number states.As a consequence, the energy needed to display all states |ℓ A and |m B would grow exponentially with the number of digits of N.
Therefore, it is more efficient to run the algorithm with qbits.Here, the number Q of qbits scales linearly with the digits of N.However, the use of qbits changes our algorithm a little bit.For example, the initial state |Ψ 0 A,B given by (29) now reads with N 2 < 2 Q , that is the dimension of the system is not anymore given by the number N to be factored.Moreover, this state can be easily prepared by applying a Hadamardgate to each single qbit whereas the state |Ψ 0 A,B is hard to create.
In the unitary phase operator Ûph defined in (30) the number N to be factored is encoded in an external variable which is independent of the dimension of the system, and can therefore be chosen arbitrarily.However, the QFT works now on a system of the size 2 Q and therefore the final state before the measurement on system B is given by where we have introduced We emphasize that this Gauss sum is a generalization of the Gauss sum W The remainder with MN +r = 2 Q consists of less than N terms, whereas the other part contains almost N 2 terms.As a consequence, we neglect R and the probability P ′ B (n, N) to measure n in system B is approximately given by

Discussion
The analysis presented in this section was motivated by the idea to replace in the Shor algorithm the modular exponentiation by the standard Gauss sum.Indeed, the approach of Sec.2 has lead us to the problem how to prepare the initial state containing the standard Gauss sum which we could solve in the present section by encoding the Gauss sum W (N ) n (ℓ) into the probability amplitudes.However, this technique suffers again from the desease, that we arrive at a state, where the factors of N are encoded in the absence of certain states.As a consequence, the search for an algorithm, which detects in an efficient way the periodic appearance of missing states is the most important task for the future of factorization with Gauss sums.
Moreover, we emphasize that by encoding the Gauss sum in the probability amplitudes we did not use the periodicity of the function itself, which was important in the Shor algorithm.The feature of the Gauss sum central to an effective factorization scheme is the fact that although there exist many more integers ℓ which are useless in factoring the number N, the product of their amount times their probability is nearly equal to the amount of integers which do help us times their probability.This is the important difference to the truncated Gauss sum A (M ) N .Here, the ratio between the probability of factors to non-factors can be as small as 1 : 1/ √ 2. Furthermore, the truncated Gauss sum only exhibits maxima for the factors themselves and not for their multiples.

Summary
So far the major drawback of Gauss sum factorization has been its lack of speed.Therefore, we have combined in the present paper the Shor algorithm with the factorization with Gauss sums.Here, we have used the features of the absolute value |G(ℓ, N)| 2 of the standard Gauss sum.Since G shows similar periodic properties as the function f (ℓ, N) = a ℓ mod N which plays an important role in the Shor algorithm, we have replaced f by g(ℓ, N) ≡ |G(ℓ, N)| 2 /N and have investigated the resulting algorithm.We have shown that f is not only special because it is a periodic function, but also because there does not exist two arguments within one period which exhibit the same value of the function.This feature is the main difference to g, where nearly all arguments within one period lead to the same functional value.Therefore, we face the problem, that we have to distill the period of g out of the zeros of a probability distribution instead of its maxima.Furthermore, by replacing f by g the QFT is not necessary anymore.
Another challenge of our combination of Shor with Gauss sums, is the creation of the initial state |Ψ A,B defined by (8) because g consists of a sum of complex numbers instead of integers.We have circumvented this problem by encoding the closely related Gauss sum W (N ) n in the probability amplitudes instead of the state.Furthermore, the number of terms in the standard Gauss sum grows exponentially with the number of digits of N which makes it necessary to develop implementation strategies different from the ones which had been sucessful [4] with the truncated Gauss sum.Therefore, we have shown how to realize the Gauss sum W (N ) n with the help of entanglement in an efficient way.Unfortunately, the resulting algorithm also sufferes from the problem that we need an efficient method to extract information from the zeros of a probability distribution.
In summary, we have investigated the similarities and differences of the Shor algorithm compared to Gauss sum factorization, which has lead us to a deeper understanding of both algorithms.Although, we have outlined a possibility for a fast Gauss sum factorization algorithm there is still the problem of the information being encoded in the zeros of the probability.As a consequence, the next challenge is to find an algorithm which performs this task and paves the way for an efficient algorithm of Gauss sum factorization.

Figure 1 .
Figure 1.Periodicity properties of the function g = g(ℓ, N ) defined by (2) for the example N = 35 = 5 • 7.This function contains one perfect period r = 35, given by the number N = 35, and two imperfect periods r = 5, 7 determined by the factors of N .At multiples k of a factor p = 5 or 7 the function g is given by the factor itself.However, if ℓ is also a multiple of N = 35 as marked by rectangles, the periodicity relation g(ℓ, N ) = g(ℓ + r, N ) does not hold anymore.

Figure 2 .
Figure 2.For numbers N with more than two factors such as N = 105 = 3 • 5 • 7, there exist several imperfections of the periodic behavior of g which stands out most clearly for multiples of factors such as p = 5.Whenever the argument ℓ is a multiple of a product of two or more factors, such as ℓ = 30 = 2 • 3 • 5, the signal is enhanced, and the periodicity relation is not valid at these arguments.

3 mFigure 5 .
Figure 5. Probability distribution P (7) A (m; 91) if the measurement of system B resulted in the factor |7 B shown for the example of N = 91 = 7 • 13.Here, we have used a system of Q = 11 qbits.Clearly visible are peaks at multiples of 2 11 /7 ≈ 292.4.The inset at the bottom magnifies the distribution in the range 1 ≤ n ≤ 100, where peaks at multiples of 2 11 /91 ≈ 22.5 exist.However, they are approximately 13 2 times smaller than those at multiples of 292.4

3 mFigure 7 .
Figure 7. Probability distribution P(1)A (m; 91) of system A conditioned on the measurement of system B with the result |1 B and the QFT for the example N = 91 = 7 • 13.Here, we have used a system of 11 qbits.Clearly visible are peaks at multiples of 2 11 /13 ≈ 157.5 and 2 11 /7 ≈ 292.4.The inset magnifies the range 1 ≤ n ≤ 100 where also peaks at multiples of 2 11 /91 ≈ 22.5 exist.However, they are approximately 13 2 times smaller than the peaks at multiples of 292.4.A comparison with figure5shows that all peaks are smaller than in the case (ii).

2 Figure 9 .
Figure 9. Factorization of N = 91 = 7 • 13 with the help of the probability distribution P

2 Figure 10 . 4 | 2 .
Figure 10.Factorization of N = 91 = 7 • 13 with the help of the probability distribution P (4) A (ℓ; 91) to find |ℓ A in system A if we have measured before the state |n 0 = 4 B .The probability is proportional to |W (91) 4 | 2 .Clearly visible are the zeros when ℓ is a multiple of a factor such as p = 7 or 13.All other trial factors ℓ are equally probable.

Figure 11 .
Figure 11.Probability P B (n; 91) for system B to be in the state |n B for the example N = 91 = 7 • 13.For n = 0 the probability is largest.For multiples of a factor the probability is enhanced compared to other trial factors.
For ℓ = 0 the standard Gauss sum is given by |G(ℓ = 0, N)| 2 = N 2 .Furthermore there exist N/p − 1 multiples of p which leads to the standard Gauss sum |G(ℓ = k • p, N)| 2 = pN and p − 1 multiples of N/p with |G(ℓ = k • N/p, N)| 2 = N 2 /p.For all other trial factors ℓ, there exist N − p − N/p + 1 of them, the standard Gauss sum is given by |G(ℓ)| 2 = N.Therefore, the closed form of the purity reads µ

n
(ℓ) defined by (28) due to the different denominators in the quadratic and linear phase.For reasons we have denoted this Gauss sum W(N) n (ℓ, M) includes two arguments.For the investigation of W(N) n , we rewrite the summation index m ≡ sN + k (57) as a multiple s of N plus k and find

nFigure 12 .
Figure 12.Probability P ′ B (n; 21) for system B to be in the state |n B for the example N = 21 = 7 • 3 employing Q = 9 qbits for the algorithm.The probability is sharply peaked at multiples of 2 Q /N ≈ 24.4.