can only be calculated numerically. A numerical scheme for calculating the Groverian entanglement is described in Ref. [7]. In each step of the scheme, one qubit 1 ≤ m$_{0}$ ≤ q is selected, and the parameter values for all the other qubits in the product state are fixed. The values of x$_{m}$$_{0}$ and θ$_{m}$$_{0}$ for which the overlap with | ψ 〉 is maximized can then be found analytically. Repeating this step for every qubit several times, a maximum for the overlap over all the x$_{m}$ ’s and θ$_{m}$ ’s is found. Using such a formula to locate the maximum with respect to each qubit is much faster than successive evaluations of the overlap in a steepest descent method. This is due to the fact that the evaluation of the overlap requires resources that are exponential in q . Such a series of successive jumps in parameter space is also less likely to be misled by local maxima than the steepest descent method. A slight improvement to this scheme was used in Ref. [24], where at each step an analytical maximization was preformed over two qubits, using the Schmidt decomposition. This improved scheme is used in the present work as well. Still, the numerical calculation of the entanglement is time consuming. Furthermore, the lack of an analytical formula makes it difficult to achieve a better understanding of multipartite entanglement and its relation to quantum-computational speedup. Thus, it is worthwhile to search for analytical formulas for the Groverian entanglement of states that are relevant to quantum algorithms. Such an approximated formula is derived in Sec. IV. Shor’s algorithm aims to find a factor of a given nonprime integer N . This is done by reducing the factorization problem to the order-finding problem [27]. In the order-finding problem one selects an integer y which is coprime to N and finds its order modulo N , denoted r . By recalling that the order of y modulo N is the smallest integer such that y r = 1(mod N ) , one can see that when exponentiating y $^{a}$(mod N ) for a = 0 , 1 , 2 , . . . , the resulting series will be periodic, with a period r . This can be done simultaneously for all values of a by constructing a superposition of the Q = 2 q computational basis states in a quantum register with q qubits | ψ 〉 = 1 √$_{Q}$ Q − 1 ∑ a =0 | a 〉 . (4) 5 III. PERIODIC STATES IN SHOR’S ALGORITHM