Chapter 13
Coding Shor and Grover’s Algorithms in Qiskit
Knowing is not enough; we must apply.
Willing is not enough; we must do.
— Johann Wolfgang von Goethe
Now that we have ample experience working with Qiskit, it’s time for us to implement two very important algorithms: Shor’s and Grover’s. We covered all the theoretical details of both methods in the two previous chapters, so now we can just dive into the code and see these algorithms shine through some practical examples.
We will start by implementing the quantum Fourier transform (QFT), which is central to Shor’s algorithm. Then, we will implement Shor’s factoring method. Lastly, we will implement Grover’s search in all its glory.
We have a busy agenda ahead of us!
The topics that we will cover in this chapter are the following:
The QFT in Qiskit
Shor’s algorithm
Grover’s algorithm
After reading this chapter, you will know how to implement the quantum...