Factorization with Gauss sums: scaling properties of ghost factors

Recent experiments have shown that truncated Gauss sums allow us to find the factors of an integer N. This method relies on the fact that for a factor the absolute value of the Gauss sum is unity. However, for every integer N there exist integers which are not factors, but where the Gauss sum reaches a value which is arbitrarily close to unity. In order to distinguish such ghost factors from real factors we need to amplify this difference. We show that a proper choice of the truncation parameter of the Gauss sum suppresses the ghost factors below a threshold value. We derive the scaling law of the truncation parameter on the number to be factored. Moreover, we show that this scaling law is also necessary for the success of our factorization scheme, even if we relax the threshold or allow limited error tolerance.


Introduction
Gauss sums [1]- [3] play an important role in many phenomena of physics ranging from the Talbot effect of classical optics [4] via the curlicues emerging in the context of the semiclassical limit of quantum mechanics [5,6], fractional revivals [7,8] and quantum carpets [9] to Josephson junctions [10]. Moreover, they build a bridge to number theory, especially to the topic of factorization. Indeed, they can be viewed as a discrimination function of factors versus non-factors for a given natural number. The essential tool of this factorization scheme [11] is the periodicity of the Gauss sum.
Usually Gauss sums extend over some period which leads to the complete Gauss sum. However, recent experiments based on NMR [12,13], cold atoms [14] and ultra-short pulses [15] have demonstrated the possibility of factoring numbers using truncated Gauss sums where the number of terms in the sum is much smaller than the period. Therefore, factorization with truncated Gauss sums offers enormous experimental advantages since the number of terms is limited by the decoherence time of the system. In the present paper, we address the dependence of the number of terms needed in order to factor a given number. In particular, we find an optimal number of terms which preserves the discrimination property and at the same time minimizes the number of terms in the sum.
In order to factor a number N we analyze the signal, i.e. the absolute value of the Gauss sum, for integer arguments = 1, . . . , √ N . We call the graphical representation of the signal data the factorization interference pattern. In order to gain information about the factors of N we analyze the factorization interference pattern: whenever the argument corresponds to a factor of N we observe the maximal signal value of unity. For most non-factor arguments this signal value is significantly below unity. However, for ghost factors we observe signal values close to unity even though these arguments do not correspond to an actual factor of N . Thus ghost factors spoil the discrimination of factors from non-factors in such a factorization interference pattern. Fortunately, ghost factors can be suppressed below a given threshold 3 by extending the upper limit of the summation in the Gauss sum. This goal of completely suppressing all ghost factors provides us with an upper bound on the truncation parameter. This upper bound represents a sufficient condition for the success of our Gauss sum factorization scheme. The analysis of the number of ghost factors evaluated by the ghost factor counting function g (N , M), which depends on the number to be factorized N and the truncation parameter M, reveals that this upper bound on the truncation parameter is also a necessary condition for the success of our Gauss sum factorization scheme.
The paper is organized as follows: we first briefly review in section 2 the central idea of the factorization scheme based on the Gauss sums. In particular, we introduce complete and truncated Gauss sums and compare the resources necessary to factor a given number N . We find the first traces of ghost factors in the factorization interference pattern based on the truncated Gauss sum.
Since the truncation of the Gauss sum weakens the discrimination of the factors from nonfactors, we dedicate section 3 to deriving a deeper understanding of this feature. We find four distinct classes of arguments which result in utterly different behaviors of the truncated Gauss sum. Rewriting the truncated Gauss sum in terms of the curlicue sum allows us to identify the class of problematic arguments-the ghost factors. Moreover, we identify a natural threshold which separates factors from non-factors. For a rigorous argument we refer to appendix A.
In section 4, we obtain an upper bound on the truncation parameter of the Gauss sum needed to suppress the signal of all ghost factors below the natural threshold. Ghost factors appear, whenever the ratio of the number to be factored and a trial factor is close to an integer. This fact allows us to replace the Gauss sum by an appropriate Fresnel integral. From this expression we find the scaling law M ∼ 4 √ N for the truncation parameter M, which represents the sufficient condition for the success of our Gauss sum factorization scheme.
Finally, we analyze the ghost factor counting function in section 5 and show that the fourth-root law is also necessary for the success of our factorization scheme, even if we relax the threshold value or allow limited error tolerance. We conclude by presenting an outlook in section 6.

Factorization based on Gauss sums: appearance of ghost factors
To start our analysis we first consider the complete normalized quadratic Gauss sum which is frequently used in number theory. Here, N is the integer to be factorized and the integer argument scans through all numbers from 1 to √ N for factors of N . If is a factor then all terms in the sum contribute with a value of unity and thus the resulting signal value |A ( −1) N ( )| is one. However, for non-factor arguments the signal value is suppressed considerably as illustrated on the left in figure 1. Thus the absolute value of the Gauss sum allows one to discriminate factors from non-factors.
Factorization based on the complete Gauss sum (1) has several disadvantages. First of all, the limit of the sum depends on the trial factor . Thus the number of terms in the sum increases  (1) where M = − 1. For the right picture we have truncated the Gauss sum after M = ln N = 16 terms. At factors of N indicated by vertical lines the Gauss sum assumes the value of unity marked by red dots. The complete Gauss sum enjoys an impressive contrast due to a suppressed signal value at all non-factors. However, the truncated Gauss sum with a relatively small number of terms also allows to discriminate factors from non-factors. However, we also observe several ghost factors marked by green dots. with up to √ N . Hence, to obtain a complete factorization interference pattern in total terms have to be added.
In the recent experimental demonstrations [12]- [15] of our Gauss sum factorization scheme the number of terms in the sum translates directly into the number of pulses applied on to the system, or the number of interfering light fields. Due to decoherence it is favorable to use as few pulses as possible. Hence, the experiments employ a constant number M of pulses for each argument to be tested. Thus the resulting signal is of the form of a truncated Gauss sum rather than a complete Gauss sum of (1). Hence, we have to add terms to obtain the factorization pattern with the truncated Gauss sum. With this fact in mind we now treat the number of terms in the Gauss sum as a resource for this factorization scheme. The experiments impressively demonstrate that the truncated Gauss sums are also well suited to discriminate in the factorization interference pattern between factors and non-factors, 5 even though the summation range does not cover a full period. As a drawback we now find that the signal value at non-factor arguments is not suppressed as well as in the case of the complete Gauss sum.
In order to illustrate the effect of truncating the Gauss sum we compare in figure 1 the factorization interference patterns for the complete Gauss sum A ( −1) N ( ) (left) and for the truncated Gauss sum A (M) N ( ) (right). In a first guess we chose the truncation parameter M = ln N to depend logarithmically on the number to be factorized. It is remarkable that the small number M = 16 of terms in the truncated Gauss sum is sufficient to reveal the factors of a seven-digit number like N = 9 624 687. On the other hand we observe a number of datapoints with signal values close to one (green dots), for example at the argument = 2555.
In an experiment such points might lead us to wrong conclusions in the interpretation of a factorization interference pattern. Thus, we call arguments resulting in such critical values of the signal ghost factors.

Classification of trial factors
The frequency of appearance of ghost factors is the central question of our study. Indeed, how many terms in the truncated Gauss sum are needed in order to suppress the occurrence of ghost factors. However, we first need to identify the class of arguments which results in ghost factors. To which class of arguments (i)-(iv) the given belongs is determined by the relation between the argument and the number we are factorizing N , namely on the value of the fraction 2N / which enters the Gauss sum (3). Indeed, for the number N = 9 624 687 and the arguments used in figure 2 we find the following: (i) for a factor = 919 the fraction 2N / is an even integer, (ii) for a typical non-factor = 14 the fraction 2N / is close to an odd integer, (iii) for a ghost factor = 2555 the fraction 2N / is close to an even integer and (iv) for a threshold non-factor = 12 the fraction 2N / is an even integer plus one-half.
Thus, we see that the class of is given by the fractional part of the fraction 2N / . Hence, in order to bring out these classes most clearly, we represent the truncated Gauss sum (3) in a different form. For any argument we decompose the fraction 2N / into the closest even integer 2k and the fractional part ρ(N , ) = p/q with |ρ| < 1 and p, q being coprime, i.e.
Since exp(2π i m 2 · k) = 1 the Gauss sum (3) reads where we have introduced the normalized curlicue function [5,6] which we consider for a real argument τ with −1 τ 1. The connection (6) between the truncated Gauss sum A (M) N ( ) defined in (3) and the normalized curlicue sum s M (τ ) for a given N is established by the fractional part ρ(N , ) of the fraction 2N / . Indeed, factors of N correspond to ρ = 0. All other values of ρ correspond to non-factors. In particular, ghost factors have ρ values close to zero.
We depict the connection of figure 3 for the number to be factorized N = 559 = 13 × 43 and the truncation parameter M = 2. The upper-left plot represents the master curve |s 2 (τ )| (blue line) given by the absolute value of the normalized curlicue sum (7). The function |s M (τ )| is even with respect to τ , since Hence, it depends only on the absolute value of τ . Moreover, we note two characteristic domains of |s M (τ )|: (i) the function starts at unity for τ = 0 and decays for increasing τ . This central peak around τ = 0 is the origin of the ghost factors. (ii) After this initial decay oscillations set in whose amplitudes seem to be bound.  (7). This curve is an even function with respect to τ and attains the values above 1/ √ 2 only in the narrow peak located at τ = 0. The factorization interference pattern for N = 559 shown in the upper-right corner follows from the dots in the upper-left plot in a two step process going through the master curve: from we find the fractional part ρ(N , ) which determines through the master curve the signal value as indicated by the arrows.
Indeed, in appendix A we show that in the limit of large M the absolute value of the normalized curlicue sum |s M (τ )| evaluated at nonzero rational τ is bounded from above by 1/ √ 2. The lower-left plot shows the distribution of the fractional parts ρ(N , ) given by (5). The dots in the upper-left plot arise from the projection of the fractional parts (5) of the lower-left plot on to the master curve. Those data points represent the factorization interference pattern for N = 559, as depicted on the right.

Upper bound on the truncation by complete suppression of ghost factors
Ghost factors emerge from the central peak of the absolute value of the normalized curlicue function. Our goal is to suppress these ghost factors by increasing the truncation parameter M. For this purpose, we display in figure 4 the normalized curlicue sum (7) in the neighborhood of τ = 0 in its dependence on τ and M. Indeed, we find a narrowing of the central peak with increasing M. In this way, we can suppress the ghost factors below a natural threshold.
As shown in appendix A for nonzero positive rational τ = p/q the absolute value of the normalized curlicue sum is asymptotically bounded from above by 1/ √ 2. Due to the connection (6) between the normalized curlicue sum s M (τ ) and the Gauss sum A (M) N ( ) it is natural to use this bound as a natural threshold between factors and non-factors. This observation allows us to define the ghost factor properly: ghost factors of a number N arise when the fractional part ρ(N , ) of 2N / leads to a value of the normalized curlicue function |s M (ρ)| in the domain between 1/ √ 2 and unity. We now determine the truncation parameter M 0 such that we can push the absolute value of the Gauss sum for all ghost factors below the natural threshold of 1/ √ 2. Ghost factors appear for small values of τ . This fact allows us to replace the Gauss sum by an integral which leads us to an estimate for the truncation parameter M 0 .
Indeed, with the substitution u = √ 2τ m we can approximate the normalized curlicue function with the Fresnel integral [16] F(x) =  (7) shown by black dots and its approximation (9)  familiar from the diffraction from a wedge [17]. We note that in the continuous approximation the normalized curlicue function depends only on the product M × √ 2τ . In figure 5, we compare the absolute value of the discrete curlicue sum s M (τ ) and the continuous Fresnel integral F(M √ 2τ )/(M √ 2τ ) at small value τ = 10 −3 . This approximation impressively models the results of the discrete curlicue sum.
We are now looking for the truncation parameter M 0 such that for a given fractional part τ the absolute value of the integral (9) is equal to 1 √ 2 . We denote α(ξ ) to be the solution of the transcendental equation In particular, for the natural threshold ξ = 1/ √ 2 defining the ghost factors we find the numerical value of α(ξ ) ≈ 1.318. From the fact that F depends only on the product of M √ 2τ it follows that For the factorization of the number N the argument is varied within the interval [1, √ N ]. Consequently, the minimal fractional part arises from the ratio 2N / when the denominator takes on its maximum value = √ N . Finally, we arrive at Hence, M 0 represents an upper bound for the number of terms in the truncated Gauss sum (3) required to push all non-factors below the threshold of ξ . In particular, we find that to suppress all ghost factors below the natural threshold ξ = 1/ √ 2 we need M 0 ≈ 0.659 4 √ N terms in the truncated Gauss sum. However, we point out that the power-law (14) arises from the fact that we use quadratic phases and will be unchanged by relaxing the threshold value ξ , as the change of this threshold will only change the prefactor α(ξ ).
We conclude this section by noting that the scaling law rests on approximating the normalized curlicue sum by the Fresnel integral. In appendix B, we analyze the range of applicability of the Fresnel integral approximation (9) and find that our results lie within validity of the approximation.

Ghost factor counting function: inevitable scaling law
In the preceding section, we have derived a scaling law between the number M of terms of the truncated Gauss sum to factor a given number N . This estimate is a sufficient condition for the success of the Gauss sum factorization scheme. In the present section, we show that it is also a necessary condition. In order to illustrate this feature we first choose logarithmic truncation M = ln N and show that at the end of our factorization scheme we will be left with too many candidate factors, most of them being a ghost factor. Moreover, we show that we cannot achieve a more favorable scaling than the fourth-root dependence, (14), even if we tolerate a limited number of ghost factors.
To answer these questions we introduce a ghost factor counting function In evaluating the number of ghost factors we proceed in two steps. First, we make use of the connection (6) between the truncated Gauss sum A (M) N ( ) and the normalized curlicue sum s M (τ ). As already pointed out in section 3 the ghost factors appear only for τ values lying in the small interval [ − τ 0 , τ 0 ] around zero. The Fresnel integral approximation from section 4 allows us to determine the fractional part τ 0 where the normalized curlicue sum assumes the value 1/ √ 2. In the second step we relate the number of ghost factors g (N , M) to τ 0 by a density argument.
We determine τ 0 with the help of the continuous approximation of the curlicue sum. From (12) we obtain and we thus arrive at the total width 2τ 0 ≈ α 2 /M 2 of the interval of fractional parts resulting in signal values larger than 1/ √ 2. We now relate the number of ghost factors g(N , M) to the width of the interval 2τ 0 via the distribution of fractional parts τ for a given N . Firstly, we consider a uniform distribution. Here, we derive an analytical estimation for g(N , M) which explains the general trend in figure 6. Secondly, we discuss the case of numbers N where the distribution of fractional parts cannot be approximated as uniform. Finally, we analyze a trade-off between a smaller truncation parameter at the expense of more ghost factors. We show that this approach will not change the power-law (14).

Uniform distribution of fractional parts
Let us first for simplicity assume that the distribution of the fractional parts τ is uniform for a given number N . Here, the number of ghost factors g(N , M) is directly proportional to the width 2τ 0 of the interval of the fractional parts which lead to ghost factors.
Recalling the dependence of τ 0 on M (16) we conclude that the number of ghost factors depends via an inverse power-law on the truncation parameter M.
In figure 6, we already found indications that g(N , M = ln N ) grows faster than the logarithm of N . Indeed, from (18) we obtain which implies that g(N , ln N ) behaves like √ N . In figure 6, we display a fit according to (19). We find that this fit describes the general trend well over a large range of numbers N . However, we also observe strong variations around this general trend. The deviations indicate that the distribution of fractional parts is not uniform for certain numbers N . We analyze such numbers in section 5.2.

Non-uniform distribution of the fractional parts
In figure 6, we find that for certain numbers the actual number of ghost factors g(N , M) considerably deviates from our estimation (19). In the following we show that for such numbers the distribution of the fractional parts cannot be treated as uniform.
This unfavorable case occurs when N has only few divisors, but another number N = N + k close to N has a lot of divisors (with |k| N ). For example for the number N = 13 064 029 441 = 21647 × 603 503 (20) highlighted in figure 6 by the circle we find that obviously has a lot of divisors. Let us consider which is a divisor of N = N + k but not of N . It follows that if > 2k the fractional part of 2N / is equal to If we consider a plot of the fractional part ρ(N , ) of 2N / as a function of we will find that for divisors of N the resulting fractional parts are aligned on the hyperbola (22) and are attracted to zero. Hence for N the distribution of fractional parts ρ(N , ) is not uniform.
In the factorization interference pattern of N data-points associated with arguments corresponding to divisors of N will also be aligned to the curve As for large values of the associated fractional part −2k/ tends to zero the resulting signal values |A (M) N ( )| approaches unity. Hence, the divisors of N become ghost factors of N . We illustrate this fact in figure 7 where we plot the distribution of the fractional parts and the factorization interference pattern for two numbers: N rich in factors and N = N − 1 rich in ghost factors. To emphasize the region of fractional parts which lead to ghost factors we use the logarithmic scale. Here, we have chosen N = 13 335 840 = 2 5 × 3 5 × 5 × 7 3 which obviously has a lot of divisors, as depicted on the upper-left plot by the straight line of red points. In the factorization interference pattern shown on the right these divisors correspond to a straight line of signals equal to unity. However, the divisors of N are non-factors of N = N − 1 = 13 335 839 = 11 × 479 × 2531. Moreover, they are aligned on a hyperbola (22) and attracted to zero as shown in the lower-left plot where we can clearly identify the hyperbola of red points. Consequently, in the factorization interference pattern plotted on the right this hyperbola of arguments with small fractional parts (22) translates into the curve of ghost factors, as depicted on the right. · 3 5 · 5 · 7 3 which is rich in factors and N = N − 1 = 13 335 839 = 11 × 479 × 2531 which is rich in ghost factors. To emphasize the region of fractional parts which lead to ghost factors we use a logarithmic scale for |ρ| on the vertical axes. The number N has a lot of divisors, as depicted on the upper-left plot by the straight line of red points. In the factorization interference pattern shown on the right these divisors correspond to a straight line of signals equal to unity. However, the divisors of N are non-factors for N = N − 1. Moreover, they are aligned on a hyperbola (22) and attracted to zero as shown in the lower-left plot where we can clearly identify the hyperbola of red points. Consequently, in the factorization interference pattern shown on the right this hyperbola translates into the curve of ghost factors.

Optimality of the fourth-root law
In section 4, we have derived the fourth-root law (14) as an upper bound on the truncation parameter. We will now show that it is also necessary for the success of our factorization scheme.
The analysis of g(N , M) revealed that it behaves similarly to the inverse power in M (18). The closer the distribution of the fractional parts for a given N the better the estimation (18) fits the actual data.
In figure 8,   The inverse power-law (18) suggests an alternative truncation of the Gauss sum when we tolerate a limited number of ghost factors, say K . Indeed, the power-law reduces the number of ghost factors considerably for small values of M. On the other hand, it has a long tail, which implies that we have to include many more terms in the Gauss sum in order to discriminate the last few ghost factors. However, this approach will not change the power law dependence of M, (14), as equation (18) yields that terms are required to achieve this goal. Let us point out that this result holds if we can approximate the distribution of the fractional parts by uniform distribution. However, as we have seen in figure 8, if this simplification is not feasible such M K might be even greater. Therefore, we cannot achieve a better scaling on N than 4 √ N , even if we tolerate a limited number of ghost factors.
We conclude that the scaling M 0 ∼ 4 √ N of the upper limit of the Gauss sum A (M) N provides both sufficient and necessary condition for the success of our factorization scheme. Using M 0 terms in the Gauss sum we can suppress all ghost factors for any number N . From the relation (4) we see that we need to add ∼ 4 √ N · √ N = N 3/4 terms for the success of the factorization scheme based on the truncated Gauss sum. In comparison with the value of ∼N of terms required for the complete Gauss sum (2) we have gained a factor of fourth-root. We emphasize that we cannot reduce the amount of resources further.

Conclusion
Motivated by the use of truncated Gauss sums in the context of factorization of numbers we have investigated the dependence on the upper limit of the summation. We have identified four distinct classes of candidate factors with respect to the number to be factorized N . In particular, with the help of the normalized curlicue sum we have found a simple criterion for the most problematic class of ghost factors. The natural threshold of the signal value of the Gauss sum which can be employed to discriminate factors from non-factors was identified. We have derived the scaling law M 0 ∼ 4 √ N for the upper limit of the Gauss sum which guarantees that all ghost factors are suppressed, i.e. the signal values for all non-factors lie below the natural threshold. Unfortunately, we cannot achieve a more favorable scaling even if we change the threshold value or tolerate a limited amount of non-factors.
However, a generalization of Gauss sums to sums with phases of the form m j with 2 < j might offer a way out of the fourth-root scaling law. Indeed, such a naive approach suggests the scaling law M 0 ∼ 2 j √ N . For an exponential phase dependence m m we would finally achieve a logarithmic scaling law. However, these new phases bring in new thresholds and a more detailed analysis is needed. However, the answer to these questions goes beyond the scope of the present paper.
Moreover, the analysis of the non-uniform distribution of the fractional parts provides us with a new perspective on the ghost factors. So far we have treated them as problematic trial factors which might spoil the identification of factors from the factorization interference pattern. However, the fact that the ghost factors of N are factors of numbers close to N offers an interesting possibility-by factorizing N we can find candidate factors of numbers close to N . Indeed, as we have found in (23) the factors of N ± k align on the curve γ (M) k ( ) in the factorization interference pattern of N . Hence, if we identify the data points lying on these curves we find candidate factors of N ± k. However, to take advantage of this positive aspect of ghost factors we need a very good resolution of the experimental signal data.
We illustrate this feature in figure 9 on the factorization interference pattern of N = 32 183 113 = 613 × 52 501. Here, we have chosen the truncation parameter according to M ≈ ln N ≈ 17 which leads to an interference pattern with several ghost factors. However, we can clearly fit the ghost factors to curves γ (17) k ( ) for k = 1, . . . , 5. Hence, by factorizing N we also find candidate factors of N ± k with k = 1, . . . , 5.
Ghost factors are factors of neighboring numbers which make their way into the interference pattern through the curlicue sum. Since the curlicue sum is a continuous function of N / , factors of neighbors of N emerge like factors of N . These two sentences summarize the central topic of the present paper and at the same time give a rather positive outlook. A detailed study of this idea is currently underway. belongs to the jth step in the repeating curlicue pattern with τ 0 = τ . The recursion terminates [5] at τ µ = 0 which implies τ µ−1 = 1/b where b is a natural number.
Since τ j < 1, we find the estimate 3) The case b = 1 cannot be produced by the recursion formula since all τ j are strictly less than one. As a consequence the absolute value of the normalized curlicue sum |s M (τ )| is asymptotically bound from above by 1/ √ 2.

Appendix B. Applicability of the Fresnel approximation
In this appendix, we briefly discuss the range of applicability of the continuous approximation (9). The scaling law M 0 ∼ 4 √ N connecting the number to be factored with the truncation parameter M 0 necessary to push all ghost factors below the threshold 1/ √ 2 relies on the approximation of the normalized curlicue function by the Fresnel integral. For large values of N the scaling law requires large values of M 0 . However, for large M the continuous approximation might not hold any more.
Indeed, for the continuous approximation to hold true the phase difference π (m + 1) 2 − m 2 τ = π(2m + 1)τ (B.1) of two successive terms in the sum (7) should at most be of the order of π . Together with the fact that the maximal phase difference appears for m = M we arrive at the inequality τ (2M + 1) < 1.