The Quantum Sieve of Eratosthenes

Quantum parallelism is a phenomenon that Nature herself seems to be suggesting as a means to getting around repetitive chores of forbidding duration. It is the cornerstone of most if not all interesting quantum computing schemas and the main factor responsible for computational speedups of some quantum algorithms, e.g. Shor’s pioneering integer factorization algorithm, [1]. Arguably, quantum parallelism may be so distinct a feature of quantum algorithms that the efficiency some of them provide will remain unachievable within the Church-Turing’ian model of computation [2,3].


Introduction
Quantum parallelism is a phenomenon that Nature herself seems to be suggesting as a means to getting around repetitive chores of forbidding duration. It is the cornerstone of most if not all interesting quantum computing schemas and the main factor responsible for computational speedups of some quantum algorithms, e.g. Shor's pioneering integer factorization algorithm, [1]. Arguably, quantum parallelism may be so distinct a feature of quantum algorithms that the efficiency some of them provide will remain unachievable within the Church-Turing'ian model of computation [2,3].
In this article we explore possible advantages of some quantum structures deemed analogous to the classical sieve of Eratosthenes. The main idea is to set a bipartite quantum system in a state of the form Σa lk |l〉 k〉 with amplitudes a lk nonzero only if k|l (i.e. l can be divided by k without remainder). We refer to such states as Eratosthenian states or, simply, E-states. If we were skilled in the art of creating E-states with good control they could be used for efficient integer factorization. Suppose we wanted to find a divisor K of N, where N is a number with nlog N bits (in binary representation). All we would have to do is implement an E-state with only a polynomial in n quantity of comparable-magnitude amplitudes a lk ≠0, including a Nk ≠0. If such a state were created we would be able to find the factor K of N with only a polynomial in n number of trials. Note that for a construction of such a state K need not be known a priori. Instead, it would suffice to ensure that the state is an E-state and that its nonzero amplitudes would have the first index concentrated near N, which is much more generalist a description. The challenge is to find ways of implementing such states. In Section 3 we propose several ways of implementing E-states on a quantum computer. Unfortunately all the methods we have found thus far result in a number of nonzero amplitudes that is exponential in n. However, it is not clear if this should be inevitable. Is there a fundamental constraint preventing successful realization of E-states with amplitudes concentrated in small areas of interest? For now this is an open question. A sceptic might argue that perhaps the whole idea should be dismissed as backward, given that a superior algorithm is already known-namely, the algorithm of Shor. However, we take an opposing view. Indeed, we find the concept to be intriguing for at least these three reasons: First, we do not exclude the possibility that future research could bring a discovery of a method enabling construction of very rarefied E-states with only a polynomial in n number of nonzero amplitudes placed in targeted places. Alternatively, in time we may be able to understand the fundamental reasons why this is impossible or intractable, e.g. by finding arguments for uncomputability of such states or at least a revealing constraint on the required physical resources. Second, as demonstrated in subsection 3.4, the concept of E-states enables implementation of the Dirichlet multiplication on a quantum computer. This new algorithm is interesting in its own right. Third, as shown in Subsection 2.2 the set of E-matrices (a notion slightly more general than that of E-states, the latter necessarily requiring normalization) forms a noncommutative ring, which extends the classical Dirichlet ring. We feel that an occurrence of a fundamental and, to our knowledge, entirely new algebraic structure further strengthens the case for E-states.
It is one of the conclusions reached in this paper that the algebra of the Dirichlet polynomials -i.e. objects of the type , s n a n s − ∈ ∑  , where the sum is finite -may be handled by a quantum computer. This extends our earlier work in which we demonstrated that the Dirichlet polynomials may be efficiently manipulated on a classical computer. In both cases the manipulation of Dirichlet polynomials is enabled by their matrix representation (which also extends to the infinite Dirichlet series). This fact has numerous practical applications [4][5][6].

E-matrices
Consider a matrix A=[a nk ], and either n,k∈{1,2…N} or both indices run over the entire set of positive integers . We will say that A is Eratosthenian (an E-matrix for short) if and only if.  a  a  a  a  a  a  a  a  a  a  E  a  a  a  a  a  a  a a a a a a where the entries represented by centred dots are necessarily zeros, and only if k|n the entry a nk may be nonzero. If an E-matrix E is N-by-N, we write E∈  N and if it is infinite, extending indefinitely to the right and down, we write E∈  ∞ . Note that the number of nonzero elements in the n'th row of an E -matrix is at most d(n) (i.e. the number of divisors of n). For E∈  N the overall number of nonzero entries is at most It is demonstrated in Subsection 2.2 that every  N , N∈{2,3,4…}∪{∞}, is a ring with respect to the regular matrix addition and multiplication. We also point out that every  N contains a nontrivial commutative subring. To see this we introduce the following definition. Namely, we say that an E-matrix is a Dirichletian matrix (D-matrix for short) if a nk =α n/k for a sequence[α 1, α 2 …] which may be finite or infinite. We let  N , N∈{2,3,4…}∪{∞} denote the set of all N-by-N D-matrices. It is easily seen that  N is a commutative subring of  N . Also, it is known, see [6], that  ∞ is isomorphic to the Dirichlet ring, i.e. the ring of infinite sequences with component-wise addition and the Dirichlet multiplication Therefore,  ∞ furnishes a noncommutative extension of the Dirichlet ring.

E-matrices form a noncommutative ring
Readers who are interested only in the quantum-computing applications of E-matrices may skip this subsection. Proof: It is obvious that  N is a group with respect to matrix addition. Furthermore, the identity matrix clearly is the unit of multiplication. Next, we verify that the product of two E matrices is an E-matrix. Indeed, for A,B∈ N let [c nk ]=C=AB. We have (Here,k|d|n is used as shorthand for: k|d & d|n.) Thus, for the righthand side sum to be nonzero at least one of the terms must be nonzero, which implies k|n, i.e. C is an E-matrix.
It follows from (3) that if A,B∈ N and AB=I, then a nn b nn =1. Thus, for a matrix A∈  N to have a left or right inverse in  N it is necessary that all its diagonal entries be nonzero. Next, let A=[a nk ]∈  N and a nn ≠0 for all 1 Note that  N with N finite inherit the Dirichlet multiplication with obvious modifications. These are the only objects that one can hope to implement numerically.
n. We will construct B∈  N such that AB=I. Indeed, suppose: Where δ nk ∈{0,1} is the Kronecker delta. This determines the diagonal entries of B, namely, b nn =1/a nn for all n. In addition, if k|n, k<n, then (4) implies: Note that (5) determines b nk via b mk (k|m) with m<n. This furnishes a recurrence formula for the off-diagonal entries of B that is the right inverse of A. If A is finite it is clear that B is also the left inverse, i.e. BA=I. Therefore, in the rest of the proof we assume that A is infinite. We will find its left inverse C∈  N, i.e. CA=I. As before, assume: It follows that c nn =1/a nn for all n. Furthermore, if k<n, k|n, (6) implies: This gives recurrence for c nk if the indices are suitably ordered. Namely, if l|m and k|n we say (m,l)(n,k) if either m<n or m=n and l>k. Observe that in (7) c nk is determined via c nl with (n,l)(n,k). Thus construction by recurrence yields C such that CA=I. Finally, note that C=CI=CAB=IB=B , i.e. the left and the right inverses of A are equal. This completes the proof. Proof: In light of Theorem 2.1 we see that the set of non-invertible elements in  N (N>2) or  ∞ is not additively closed. Indeed, the sum of two E matrices each with some zeros on the diagonal can yield a matrix whose all diagonal entries are all nonzero. The claim then follows from Theorem 7.1.1 in [8].
Remark 1: Note that the set of all matrices in  N (or  ∞ ) with a zero column (resp. zero row) is a left (resp. right) ideal. The fact that a ring is not local means that the set of non-invertible elements is not a twosided ideal. Moreover, neither of the rings has a largest proper left or right ideal, [8].
Remark 2: Note that the recurrence formulas (5) or (7) yield the inverse matrix by filling up consecutively increasing blocks. This can be viewed alternatively in the following way. A matrix A∈  N has a block structure as follows: , and let us look for A -1 in the form, In such a case A -1 A=I is equivalent to the following set of constraints: Ψ〉 ∈ ⊗   whose dynamics, in the simplest possible case 2 , is determined by the composite system Hamiltonian, Suppose the composite system is initialized in the state, Where E=[a nk ] is an E-matrix with the Hilbert-Schmidt norm ( ) with the initial condition Ψ(0)=Ψ E amounts to a separable evolution of the coefficients and so | ( ) = . This means that if |Ψ(t)〉 is represented in the |n A 〉|k B 〉 basis via an E-matrix at one time, it will remain to be represented by an E-matrix for all times. It is therefore justifiable to call an evolving state as this an E-state. Since time evolution of the phase factors is inconsequential for the discussion that follows we will make no further reference to it.

Quantum measurements and integer factorization
Suppose an E-state |Ψ(E)〉 has been prepared in such a way that a nk ≠0 ⇒ k|n. Suppose we wish to factor a specific integer N. A measurement of the composite system energy returns a pair ((n,k)) where with probability one k|n. However, the probability of drawing such a pair is exactly |a nk | 2 . This means that if all |a nk | have comparable magnitude, we need at least σ(N)=O(NlogN) trials to find a specific pair -the number of trials is exponential in log N or exponential in the number of bits used to represent N. This would change if we were able to prepare the system in an E-state concentrated on the components of the form |n A 〉|k B 〉 where k|n. This is, of course, a hard problem. We discuss it from the point of view of quantum computing in Section 3.

E-states on a quantum computer
In this section we consider two different approaches to the construction of an E-state on a quantum computer. The first method relies upon the quantum multiplication circuit, while the second utilizes a quantum gate implementation of a specific arithmetic function. In both cases the resulting state is a superposition of a pure E-state with some additional "artefact" state components. However, as explained below, the pure E-state components are separated from the artefact components by their index range. Thus pure components can be separated a posteriori by a rudimentary classical observation or, alternatively, enhanced via the procedure known as amplitude amplification, [9].
The departure point for both constructions is the known process for creating an equal superposition state, see e.g. [10]. This is obtained by an application of the single qubit Hadamard gates to the ground state:

An E-state from quantum multiplication
We will demonstrate how to prepare an E-state on a quantum computer with a quantum random access memory consisting of two registers. We let |x〉 |y denote the state of the registers, where it is understood that |x〉=|x 1 ,x 2 ,x 3 ,..x n 〉 is an n-qubit representation and, similarly, |y〉=|y 1 ,y 2 ,y 3 ,..y n 〉. Well known are quantum computing implementations of certain basic arithmetical operations, see e.g. [11,12] including addition and multiplication. We will make use of the multiplication circuit, implementing |x〉=|x 1 ,x 2 ,x 3 ,..x n 〉 |x〉|y〉|x〉|x.y〉 Where x.y denotes the product of two integers. (Here, multiplication may be effectively replaced by multiplication mod 2 2n .) However, since multiplication by zeros is not interesting we introduce a modification. Namely, we first add 1 to both x and y, effectively using |x〉|y〉|x+1〉|(x+1)(y+1)〉 (12) Note that |x〉〉|x+1〉 is unitary, and implementable as simplified addition, as long as the register is by one qubit larger that the maximal value of x. Similarly, unitarity implies that |x+1〉|(x+1)(y+1)〉 cannot fall off the register range. Therefore, the second register should have at least M=2 2n qubits. We will now combine (11) with (12) to create an E-state. Indeed, in step one we set both registers in the equal superposition states: The output state is very similar to an E-state except for some artefacts. The artefacts can be effectively dealt with either by treating them as a tolerable nuisance, and doing nothing until the quantum information is accessed, or else countermanding them via an application of the Grover's search (amplitude amplification). We illustrate the procedure by an example with n=2, and M=n 2 =4. Note that the first register must support n+1=3 qubits. The end state in this case has the form (here c=1/4): Note that not shown are rows corresponding to the states |5〉,|6〉,|7〉 or |0〉 on the first register-these rows contain only zero entries. Furthermore, note that the submatrix corresponding to values |1〉,|2〉,|3〉,|4〉 on the second register is the transpose of an E-matrix 3 . We also note that a measurement on both registers returns a pair of integers (a,b) where, a|b. (In the example at hand the special pair (4,0) signifies (4,16)). Note that those components of the output state that correspond to values other than |1〉,|2〉,|3,|4〉 on the second register cannot be erased, because such an operation would not be unitary. However, the resulting state contains an E-state as a separable component. Summarizing, the proposed algorithm for the creation of an approximate E-state consists of the following steps: • Prepare an initial state according to (11).
• Compute the (shifted) quantum product according to (13). As a result obtain an output state |Ψ out 〉=|Ψ E 〉+|Ψ R 〉, where |Ψ E 〉 is (proportional to) an E-state and |Ψ R 〉 is a remainder.
• Separate |Ψ E 〉 classically in the following sense: the measurement outcomes that belong in an E-state component are precisely those |x〉|z〉 where z∈{1,2…2 n } • Optionally, depending on an application, it may be beneficial to engage the generalized Grover's search as a processing step preceding the classical separation. This step provides amplitude amplification, effectively boosting the weight of the |Ψ E 〉 component and suppressing that of the |Ψ R 〉. . However, measurements on the full output state provide useful information, and separation of the E-state pointed out in the last step of the algorithm need not always be desirable. We emphasize that the probability of obtaining from measurement any pair a|b is always the same and equal to 2 -2n .

Remark 2:
The network complexity for multiplication of two registers is of the order n 2 . There are several known circuit architectures implementing multiplication. While some implementations rely on the quantum Fourier transform, [12], the classical Vedral-Barenko-Ekert algorithm does not use it, [11]. Even though the latter algorithm demands a greater memory resource, it seems to secure computational stability independent of the input size.

Remark 3:
Recall that the Grover search, as well as its various generalizations known as the amplitude amplification algorithms, [9], rely on the Grover rotation. To briefly summarize the principle and compute the complexity, we turn attention to |Ψ out 〉=|Ψ E 〉+|Ψ R 〉. The quantities a=〈Ψ E |Ψ E 〉 and b=〈Ψ R |Ψ R 〉 represent the probabilities of measuring a good component, in the support of |Ψ E 〉, and a bad component in the support of |Ψ R 〉. We wish to apply a quantum circuit to |Ψ out 〉 so as to boost the probability of measuring the good component. To this end we use the Grover's rotation: Grover's rotation is applied k times to |Ψ out 〉 so that G k |Ψ out 〉 approaches a -1/2 |Ψ E 〉. The value of k depends on the initial partition of energy between |Ψ E 〉 and |Ψ R 〉 or, in other words, the ratio of the number of good states to the number of bad states. We have,

An E-state from f(x)=[N/x]. x.
This method is based on a quantum implementation of the arithmetic function f(x)=[N/x]. x, x∈. (We will not discuss the specific circuit implementation of this function, all reversible classical functions can be converted into quantum computations [13]. We wish to construct an E-state concentrated near the N'th column, where N<2 n . To this end we prepare the state The result is a relatively sparse E-state in superposition with an artefact vector. Let us illustrate this with an example for N=6. Selecting n=3, we obtain the following state matrix ( Here |α〉=Σα x |x〉 is regarded as given, A is a classically known matrix, and |β〉=Σ β x |x〉 is to be computed. Of course, prerequisite to this procedure is the possibility of implementing on a register the state |α〉 with the particular set of amplitudes. One method for accomplishing that is indicated in [15]. We base the following discussion on the possibility of implementing a state where {|α x | 2 } is a probability distribution 4 on {1,2,…2 n } With this understood, we will now show how to use the concepts introduced in the preceding paragraphs to describe an implementation of new types of E-states as well as the realization of the Dirichlet multiplication of the amplitude vectors. First, consider a straightforward generalization of (13). Namely, n n n n n n x y x y x y out n n n x y x y x y x y x y x x y Let us examine an example, assuming n=2, and M=n 2 =4 (M=4 is the number of qubits required for the second register, and n+1=3 is the number of qubits required for the first register.) In such a case |Ψ out 〉 assumes the form:

Remark:
We recall that the known QFT algorithm has Θ(n 2 ) complexity. Of course, since the QFT depends on unitary transforms with terms like exp 2πi/2 n its hardware implementation requires precision (in terns of energy control or ultra-short pulse control, etc.) that is exponential in n. Notably, however, in some applications this difficulty may be overcome by replacing the QFT with the approximate quantum Fourier transform (AQFT) introduced in [16]. It is interesting to enquire whether the AQFT might facilitate additional gains also in the task of integer factorization via E-states. However, we do not undertake to address this problem here.

Remarks on E-states of quantum systems in thermal bath
As explained above once an E-state of the form (10) is formed, it will be preserved essentially unchanged in time (except for the unessential phase factors) as long as no measurement is conducted on the composite system. In this section we consider the problem of forming such a state outside the framework of the universal quantum computer. Indeed, one might hope that abandoning the constraint of universality would open more options for achieving such a goal. The approach we consider is based on the thermodynamic equilibrium, and utilizes the results in [17,18].
For simplicity we henceforth assume that |Ψ E 〉 is effectively finite. The first observation is that an E-state may be reduced to a more standard state via the Schmidt representation. Indeed, let E=USV* be the SVD decomposition of the matrix E= [ We will use these observations to attempt a construction of a quantum system regime in which |Ψ E 〉 will become its stationary state. The basic concept of adiabatic computing is to switch from the regime that instils |Ψ E 〉 back to the dynamics governed by the Hamiltonian (9) not disturbing the system state. To this end, one might try to construct an isolated system Hamiltonian for which (17)  h h const . Unfortunately, the completely degenerate Hamiltonian is useless in distinguishing a specific state, since it views any state as stationary. However, consider as an alternative the evolution of the system stabilized by a heat bath at constant temperature T. When the system is in equilibrium, the Helmhotz free energy will be minimized. The Helmholtz free energy is given by:  (19), the system will settle in a stationary state of . Such a state is then expected to be an E-state w.r.t. the |n A 〉|k B 〉 basis. However, the following questions appear to have fundamental significance as regards feasibility of creating an E-state via the proposed process: First, could the SVD data of an Eratosthenian state be known a priori and explicitly? Second, even with the assumption that the SVD data are known a priori, would it be possible to build a machine that instils a regime described by (18)

Discussion and Results
We have discussed novel algebraic and computational structures based on the concept of Eratosthenian matrices (E-matrices) and Eratosthenian quantum states (E-states). We have observed that E-matrices furnish a noncommutative extension of the classical Dirichlet ring. We have also considered the task of initializing and manipulating E-states on a quantum computer and introduced an algorithm that implements the Dirichlet product of quantum state vectors. In addition, we have pointed out that if a method was known for efficient initialization of E -matrices with targeted narrow supports it would facilitate efficient factorization of integers.