  Quantum coherence in a qubit is vulnerable to environmental noise. When long
quantum calculation is run on a quantum processor without error correction, the
noise often causes fatal errors and messes up the calculation. Here, we propose
quantum-circuit distillation to generate quantum circuits that are short but
have enough functions to produce an output almost identical to that of the
original circuits. The distilled circuits are less sensitive to the noise and
can complete calculation before the quantum coherence is broken in the qubits.
We created a quantum-circuit distillator by building a reinforcement learning
model, and applied it to the inverse quantum Fourier transform (IQFT) and
Shor's quantum prime factorization. The obtained distilled circuit allows
correct calculation on IBM-Quantum processors. By working with the
quantum-circuit distillator, we also found a general rule to generate quantum
circuits approximating the general $n$-qubit IQFTs. The quantum-circuit
distillator offers a new approach to improve performance of noisy quantum
processors.
