---
title: Shor–Kitaev Algorithm
url: https://www.emergentmind.com/topics/shor-kitaev-algorithm
type: topic
---

# Shor–Kitaev Algorithm

Searching arXiv for the cited papers and related terminology to ground the article in current arXiv records.
The **Shor–Kitaev algorithm** usually denotes Shor’s factoring algorithm implemented through Kitaev’s iterative or semiclassical phase-estimation method: factoring is reduced to order-finding for a randomly chosen \(a\) coprime to \(N\), the order \(r=\operatorname{ord}_N(a)\) is encoded as an eigenphase of modular multiplication, and classical postprocessing by continued fractions and greatest-common-divisor computations extracts nontrivial factors when \(r\) satisfies the standard parity and nontriviality conditions [1507.08852, 2205.01925]. In the quantum-compilation literature, however, the phrase is sometimes used for the distinct Solovay–Kitaev algorithm, which concerns unitary compilation rather than order-finding; the two usages are mathematically unrelated beyond the shared association with Kitaev [2112.02040].

## 1. Terminology and scope

In the factoring literature, the relevant object is the reduction from integer factorization to modular order-finding. Given an odd composite \(N\) and a uniformly random \(a\) with \(\gcd(a,N)=1\), one seeks the least positive integer \(r\) such that
\[
a^r \equiv 1 \pmod N.
\]
If \(r\) is even and \(a^{r/2}\not\equiv -1 \pmod N\), then the nontrivial factors of \(N\) are obtained from
\[
\gcd(a^{r/2}-1,N),\qquad \gcd(a^{r/2}+1,N).
\]
If these conditions fail, the procedure is repeated with a new base \(a\) [1712.07311, 1507.08852].

The “Kitaev” qualifier refers to the replacement of the wide control register and global QFT of textbook Shor by an iterative, semiclassical phase-estimation loop on a recycled control qubit. This reduces the quantum width from roughly \(3n\) qubits to \(n+1\) quantum qubits, with \(n=\lceil \log_2 N\rceil\), at the cost of mid-circuit measurement, reset, and classical feedforward [1507.08852, 1908.07187].

A persistent source of ambiguity is that “Shor–Kitaev” is also used informally for the Solovay–Kitaev compilation theorem. That usage is nonstandard in the factoring context. The factoring algorithm concerns phase estimation of modular multiplication; the compilation algorithm concerns approximation of arbitrary target unitaries by products from a universal gate library [2112.02040].

## 2. Order-finding as an eigenphase problem

The quantum subroutine is built from the modular-multiplication unitary
\[
U_a |x\rangle = |a x \bmod N\rangle,
\]
acting on an \(n\)-qubit work register. If \(r\) is the order of \(a\) modulo \(N\), then the orbit generated by repeated multiplication by \(a\) has length \(r\), and one may define eigenstates
\[
|u_s\rangle = \frac{1}{\sqrt r}\sum_{k=0}^{r-1} e^{-2\pi i s k/r}|a^k \bmod N\rangle,
\]
with
\[
U_a |u_s\rangle = e^{2\pi i s/r}|u_s\rangle.
\]
Phase estimation of \(U_a\) therefore returns an estimate of the phase \(s/r\), from which \(r\) is recovered classically [1908.07187, 2509.05010].

In the standard QFT-based formulation, a control register of \(t\) qubits is prepared in a uniform superposition and a work register is initialized to \(|1\rangle\). Controlled powers \(U_a^{2^j}\) are applied, followed by a QFT on the control register. The pre-QFT joint state can be written as
\[
|\Psi\rangle = 2^{-n/2}\sum_{x=0}^{2^n-1} |x\rangle \otimes |a^x \bmod N\rangle,
\]
and, when reindexed by the order \(r\), it exhibits an explicit \(r\)-term Schmidt structure across the control-work bipartition [1705.01140].

The textbook Shor circuit and the Kitaev-style circuit use the same controlled powers \(U_a^{2^j}\). Their difference lies in the readout mechanism. In the former, phase information is extracted by a global QFT on a control register of width approximately \(2n\). In the latter, the same phase is read out sequentially, bit by bit, using a single recycled control qubit and classical feedback [1712.07311, 1507.08852].

## 3. Iterative phase estimation and the semiclassical QFT

Kitaev’s iterative phase-estimation method replaces the \(2n\)-qubit Fourier register by a one-qubit control recycled across approximately \(2n\) stages. At each stage, the control qubit is prepared in \(|+\rangle\), a controlled-\(U_a^{2^j}\) is applied, a phase correction depending on earlier measurements is inserted, then a Hadamard is applied and the control is measured. The measured bit is stored classically, the qubit is reset, and the cycle repeats [1507.08852, 1908.07187].

If the unknown phase is \(\phi\), then at iteration \(m\) the control accumulates phase \(2\pi 2^m \phi\). With previously extracted bits \(b_0,\dots,b_{m-1}\), the classical estimate
\[
\tilde{\phi}_m = \sum_{\ell=0}^{m-1} \frac{b_\ell}{2^{m-\ell}}
\]
determines the feedforward angle
\[
\theta_m = -2\pi \tilde{\phi}_m.
\]
After the correction and Hadamard, the outcome probabilities are
\[
P(b_m=0)=\cos^2\!\big(\pi(2^m\phi-\tilde{\phi}_m)\big),\qquad
P(b_m=1)=\sin^2\!\big(\pi(2^m\phi-\tilde{\phi}_m)\big),
\]
so the next phase bit is obtained from a single-qubit interference experiment rather than a coherent multi-qubit QFT [1908.07187, 2509.05010].

This architecture is frequently described as a semiclassical QFT or Griffiths–Niu-style inverse QFT. In the Innsbruck ion-trap implementation it appears as \(KQFT^{(M)}\), a semiclassical QFT acting \(M\) times on one physical control qubit with real-time feedforward [1507.08852]. In software-oriented realizations such as Quantum-Kit, the same pattern is implemented by a hybrid circuit containing one recycled quantum control qubit, \(n\) work qubits, and \(2n\) classical bits that store measurement outcomes and drive subsequent phase rotations and reinitialization [1908.07187].

The principal resource trade-off is therefore width against latency. Standard Shor uses about \(2n\) control qubits plus an \(n\)-qubit work register, whereas the Shor–Kitaev variant uses \(n+1\) quantum qubits and classical memory, but serializes the phase-estimation process [1507.08852, 1908.07187].

## 4. Continued fractions, recovery guarantees, and success conditions

The classical postprocessing problem is to recover \(r\) from a rational approximation to \(k/r\). In the QFT-based analysis, one chooses a power-of-two modulus \(N\) satisfying \(n^2 < N < 2n^2\), measures a value \(y\), and studies \(x=y/N\). The relevant theorem is Legendre’s criterion: if
\[
\left|x-\frac{a}{b}\right| < \frac{1}{2b^2},
\]
then \(a/b\) is a convergent of the continued-fraction expansion of \(x\) [2205.01925].

For Shor order-finding, the target rational is \(k/p\), where \(p\) is the period. The detailed probability analysis shows that, with probability approximately \(4/\pi^2\), there exists \(k\in\{0,\dots,p-1\}\) such that
\[
\left|\frac{y}{N}-\frac{k}{p}\right| < \frac{1}{2p^2}.
\]
Under that event, continued fractions recover \(k/p\) as a convergent. If \(\gcd(k,p)=1\), the denominator is exactly \(p\); if not, the denominator is a proper divisor of \(p\), and repetition is required [2205.01925].

In the iterative phase-estimation version, the same continued-fraction criterion applies once the estimated phase \(\hat{\phi}\) satisfies
\[
|\hat{\phi}-k/p| \le \frac{1}{2p^2}.
\]
A sufficient precision target is \(m \ge \lceil 2\log_2 p\rceil + O(1)\), and in standard presentations one takes about \(2n\) phase bits, since \(p<N<2^n\) [2205.01925, 2509.05010].

Order recovery does not by itself guarantee successful factoring. After obtaining a candidate \(r\), one must verify \(a^r \equiv 1 \pmod N\), then check that \(r\) is even and that \(a^{r/2}\not\equiv -1 \pmod N\). Only then do the gcd computations yield nontrivial factors. If any condition fails, the run is inconclusive and a new base \(a\) is chosen [1712.07311, 1507.08852].

## 5. Entanglement structure and tensor-network simulation

The pre-QFT state generated by modular exponentiation is the entanglement bottleneck of Shor order-finding. A tree tensor network study showed that the control-work bipartition has Schmidt rank exactly \(r\), reflecting the \(r\)-fold periodic structure of the “Shor wavefunction,” and that for clusters of \(L\) control qubits the Schmidt number grows exponentially as \(\chi(L)\approx \min(2^L,r)\) before saturating. When \(r=2^m\tilde r\), measurement of the work register causes the last \(m\) control qubits to disentangle, and the remaining MPS bond dimensions saturate at \(\tilde r\) [1705.01140].

Because the Schmidt coefficients in the relevant cuts are equal, the usual tensor-network truncation strategy is ineffective: discarding singular values does not produce a controlled approximation. This explains why exact classical simulation remains exponentially hard in worst-case instances with large \(r\), even though moderate instances can be tractable when \(r\) or its odd part is small [1705.01140].

A subsequent matrix-product-state optimization sharpened this picture by writing
\[
r = 2^\alpha \beta,\qquad \beta \text{ odd},
\]
and partitioning the control register into the \(\alpha\) least-significant qubits \(A\) and the remaining qubits \(B\). Immediately prior to measuring the work register \(R\), the \(A\) qubits primarily entangle with \(R\), while the \(B\) qubits carry the multipartite \(\beta\)-dependent entanglement. After measuring \(R\), the \(A\) qubits become completely separable, and only \(B\) remains entangled [1712.07311].

The key optimization is therefore the dynamic MPS embedding
\[
B : R : A,
\]
rather than a static layout with all control qubits on one side of the work register. In the dynamic layout, the MPS matrices for qubits in \(A\) are smaller by a factor \(\beta^2\) than in the static layout, so space requirements depend on the factors of \(r\) rather than on \(r\) itself. The same work reported a 60-qubit simulation of Shor’s algorithm for \(N=961307\), \(a=5\), and \(l=20\), where \(r=479568=29973\times 2^4\); the computation used 216 nodes, 5184 cores, and 13.824 TB of RAM, with total time approximately \(26003\) s [1712.07311].

## 6. Physical realizations, desktop simulation, and modular extensions

A trapped-ion realization demonstrated a fully scalable Kitaev-style Shor algorithm for \(N=15\). The implementation effectively employed and controlled seven qubits and four “cache-qubits,” together with generalized arithmetic operations known as modular multipliers. It used one recycled control qubit, mid-circuit measurement, reset, and feedforward, and reported success probabilities in excess of \(90\%\). For bases \(a=\{2,7,8,11,13\}\), the measured orders were \(r=\{4,4,4,2,4\}\), and the squared statistical overlap with the ideal output distributions exceeded \(90\%\) for all tested bases [1507.08852].

Desktop-scale simulation has also been demonstrated in the semiclassical regime. Quantum-Kit implemented the Shor–Kitaev variant with one recycled control qubit and \(2n\) classical bits, reporting factorization of the 20-bit integer \(N=961307\) with 21 qubits in \(139\) s on a single-core desktop, and factorization of the 24-bit integer \(N=13564597\) in about \(1555\) s with 25 qubits and 48 classical bits. For the 24-bit case, two runs recovered \(r=564840\) and factors \(2161\) and \(6277\) [1908.07187].

More recent work preserves the Kitaev philosophy of a small phase register but moves from strictly one-bit-at-a-time estimation to modular windowing. In that formulation, phase estimation is decomposed into shallow, independent QPE blocks of size \(m_i\), often three or four qubits, with overlaps and a carry-aware stitching rule used to reconstruct a consistent eigenphase. The work register requirement is unchanged, but the active counting register is reduced from approximately \(2n+1\) qubits to \(m_{\max}\), and the blocks can be executed sequentially or in parallel [2509.05010]. This suggests a direct lineage from the Shor–Kitaev semiclassical reduction of width toward later blockwise, overlap-assisted phase-estimation architectures.

## 7. Distinct compilation usage: the Solovay–Kitaev algorithm

In quantum compilation, “Shor–Kitaev” is sometimes used informally for the Solovay–Kitaev algorithm, but this denotes a different problem class. The compilation problem takes a finite universal gate set \(G\subset SU(d)\) or \(G\subset SL(d,\mathbb C)\) and asks for a gate sequence \(S\) such that \(\|U-S\|\le \epsilon\) for a target unitary \(U\). In the classic inverse-closed setting, Solovay–Kitaev achieves polylogarithmic sequence length:
\[
L(\epsilon)=O(\log^c(1/\epsilon)),
\]
with the standard exponent \(c=\log 5/\log(3/2)\approx 3.97\) [2112.02040].

The 2021 inverse-free extension removed the inverse-closed assumption entirely. For any fixed \(d\ge 2\) and any gate set that densely generates \(SU(d)\), it provides an efficient algorithm using \(O(\operatorname{polylog}(1/\epsilon))\) gates, with exponent
\[
Y_d=\frac{\log(8d^2+1)}{\log(3/2)}=\Theta(\log d),
\]
and \(Y_2\approx 8.62\) for a qubit. The construction relies on approximate generalized Pauli operators and self-correcting sequences such as \(J_2(X',Y')=I+O(\epsilon^2)\) in the qubit case and \(J_a(X',Z')=I+O(\epsilon^2)\) in general dimension, which serve as inverse factories without exact inverses [2112.02040].

The distinction is therefore categorical. Shor–Kitaev in the factoring sense is an order-finding algorithm based on modular multiplication, phase estimation, continued fractions, and gcd extraction. Solovay–Kitaev is a recursive approximation theorem for unitary synthesis. Confusing the two obscures both the computational objective and the technical machinery involved [2112.02040].

Source: https://www.emergentmind.com/topics/shor-kitaev-algorithm