The three-square Gauss-Legend theorem states that a natural number n can be written as a sum of three integer squares if and only if n is not of the form 4k(8l+ 7), for nonnegative integers k and l. Based on the theorem, for n6= 4k(8l+ 7) assuming the extended Riemann hypothesis, Paul and Peter proposed a random algorithm for writing as a sum of three squares. Its expected theoretical number of bit operations is O((lgn)2·M(lgn)) and a slightly better running time, obtained by slightly complicating the algorithm, isO((lgn)2(lg lgn)−1 ·M(lgn)) .
Also, few results are included from the code of the previously expected number of bit operations I wrote.
Basic Definitions and Backgrounds
Thus, in the situation in which a(p−1)/2 6≡1 (mod p), where Theorem I.3 proves that a is a quadratic modulo without remainder, one has(p modp), so the desired conclusion follows once again. Use this and the condition on at to show that the formula is correct by squaring both sides. A natural number n can be written as the sum of three squares of integers if and only if n does not have the form 4k(8l+ 7) for nonnegative integers and l.
Thus, there must exist two distinct vectors of this type, sayx1 and x2, for whichAx1 ≡Ax2 (modm). Suppose a, b, andc are nonzero, squareless, double, and nonzero integers, not all with the same sign. By means of the Chinese remainder theorem, it suffices to show that a factorization of this type exists modulo for each ofa,b, etc.
Since either|bc|,|ac|, or|ab| is greater than 1 and a, b and c are square-free, not every λi can be an integer. We will show that there exists a rational point on x2+y2+z2 = n with common denominator d, which contradicts the minimality of d. A new root can be written as a fraction with denominator d < d, which implies that the same' is true for the coordinates of the corresponding point'a+t(A−d'a).
To prove this special case, construct a square-free positive integer r such that (r, m) = 1 and has the following two properties. Thus, m is the sum of three rational squares and, by Lemma 2.6, m is also the sum of three integer squares.
Preliminaries on ternary quadratic forms
A principal submatrix of a square matrix A is the matrix obtained by removing k rows and the corresponding k columns of A. If vj are orthogonal eigenvectors for λj, j = 1,2, then the span of thevj W must be non-trivial intersect, since the sum of the dimensions of these two subspaces of Rnexceedsn. Since the determiner of A is positive, it follows that all eigenvalues are positive, which completes the claim.
For a ternary quadratic form F, we define the adjoint F∗ as the ternary quadratic form associated with−adj(MF), where adj is the adjoint matrix. We introduced quasi-reduced form to use the fact derived from Gauss' proof of reduced form: every positive-definite ternary quadratic form corresponds to a quasi-reduced form. It can be shown using the conditions in Definition 3.3 and the fact that F is positive-definite.
Dirichlet’s proof of sufficiency in the three-square theorem
Then the doubly prime number can be represented as Dn−1 for some D≡5(mod8); furthermore, p≡3 (mod4). Using some facts in Section I, we get Then the doubly prime number can be represented as Dn−1 for some D≡3(mod8); furthermore, p≡3 (mod4). Using some facts in Section I, we get
Basic steps
Steps 1 and 2
In this section, we introduce the basic steps of an algorithm, analyze each step to calculate the bound of bit operations, and modify some steps efficiently to make a better bound. Now, recognizing that we have found the prime number in Step 1, we use Step 2 not only for determining a square root of −D modulo Dn−1, but also to check the output of Step 1. Since computing a square root of −D modulo p can be done in O((lgn)M(lgn))-bit operations, this part of the algorithm expects O((lgn)2M(lgn))bit operations .
Steps 3 and 4
We can easily check that the type I transformation does not change the value of the (3,3) entry of −adj(MF(=MF∗) when applied to F. Thus, by the way, we determine each entry of matrix I , will the transformed satisfy Before going to theorem, for a matrix M, define ||M|| to be the largest absolute value of the entries of M.
The first part of the test is to count the number of cycles until the algorithm completes. Let MFi be a matrix after iteration of the same time algorithm and a(i)kl, A(i)kl be inputs of MFi and MF∗. Thus, the algorithm would terminate with such and from (17), a bound on the number of cycles would be O(lg||MF||).
The second part of the test is to count the elementary operations in each part of the algorithm. Using the fact that process iii is applied before two conditions are checked, we can conclude that|a12|< 12|a11|. This limit is applicable to any intermediate form in the algorithm that has passed process iii.
Since process iii is executed immediately after process process and process iii are executed, a bound on elementary operations in process i and process ii is O(lg||MF||M(lg||MF||)). To count the operations in process iii, we need a bound for the entries of the associative matrix of an intermediate form. The last part of the proof is the connection of operations in the computation of the unimodular matrix A xvii.
The number of cycles of the algorithm in the proof of Theorem IV.1 is actually O(lg lg||MF||), not O(lg||MF||). A||, we can conclude that step 4, computing the entries of the third column A−1, can be performed in O(M(lgnlg lgn)) bitwise operations. Since this is asymptotically negligible compared to the bitwise operations in step 3, this part of the theorem expects a total of O((lgn)(lg lgn)·M(lgn)) bitwise operations.
Wrapping up
Find the corresponding prime p for each type n. For every prime l ≤logn that does not divide q, choose al ∈ {1,2,. p=a0+qLk, . where an integer k is chosen uniformly at random from [0, K). Selecting al, computing the corresponding a0, and selecting p can be performed in O((lgn)2) bit operations. The result of the modification is that we now randomly choose p uniformly from the set S:={u≤qLK :u≡a (modq), u has no prime factors≤logn}.
Every prime number in[2, qLK]congruent toa (modq) is already in S because congruence implies that such a prime number is not less than or equal to tologn. By combining the revised step 1 and its pre-computation with the original step 2, we can know that the total number of bit operations expected during the process is the same. This dominates the expected bit operations for Step 3 and Step 4,O((lgn)(lg lgn)·M(lgn)), and now we have better runtime.
ER01] Friedrich Eisenbrand and Günter Rote, Fast reduction of ternary quadratic forms, International Cryptography and Lattices Conference, Springer, 2001, p. Lag80] Jeff C Lagarias, Worst-case complexity bounds for algorithms in theory of integral quadratic forms, Journal of Algoritmer1 (1980), no. PS19] Paul Pollack and Peter Schorn, Dirichlet's proof of the three-square theorem: An algorithmic perspective, Mathematics of Computation88(2019), no.
I sincerely thank my advisor, Peter Jae-Hyun Cho, who provided many mathematical teachings, philosophies, and personal mentoring to make this article possible. I would also like to thank the other committee members for reading my dissertation, Hae-Sang Sun and Chol Park.