Implementing Shor'S Algorithm In Quantum Computing

Quantum computing is a rapidly developing field and within this sector, there exist numerous intriguing topics. One such topic is Shor's Algorithm, a groundbreaking quantum algorithm devised for integer factorization. Shor's algorithm utilizes the capabilities of quantum superposition and entanglement, which significantly accelerates the factoring of large integers. This is considered a crucial development as modern cryptography heavily relies on the difficulty of factoring large numbers.

### Introduction to Shor's Algorithm

Shor's Algorithm, proposed by Peter Shor in 1994, is a quantum algorithm formulated for integer factorization. This algorithm runs significantly faster than the fastest known classical factoring algorithm. Shor's Algorithm was the first quantum algorithm showing an exponential speedup over classical computations, which is pivotal as factoring is computationally hard for classical computers, but essential for decrypting secure messages.

#### Implementing Shor's Algorithm using Qiskit in Python

Qiskit in Python is a versatile tool for simulating quantum algorithms, which includes Shor's Algorithm. 
Ensure that Qiskit is installed, if not, it can be installed using `pip` as follows:

```python
pip install qiskit

Here is a basic implementation of Shor's Algorithm in Qiskit, for factoring 15:

from qiskit import QuantumCircuit, execute, Aer from qiskit.visualization import plot_histogram n = 8 n_count = 8 qc = QuantumCircuit(n+n_count, n_count) for q in range(n): qc.h(q) qc.x(3+n) for q in range(n): qc.append(c_amod15(a, 2**q), [q]+[i+n for i in range(4)]) qc.append(qft_dagger(n), range(n)) qc.measure(range(n), range(n)) qc.draw('text')
Understanding the code

Firstly, we initiate a quantum circuit with n qubits initialized in superposition and a classical register. Qiskit’s QuantumCircuit.h() applies the Hadamard gate that forms the superposition.

Shor's algorithm depends on modular exponentiation, and 'c_amod15' denotes the circuit for modular exponentiation operation for a mod15 function. The for loop creates repeated applications of the operation.

Qiskit’s inbuilt Quantum Fourier Transform (QFT) implementation qft_dagger(n) is utilised to perform an inverse QFT, transforming from the order to phase. The phases would then be measured by the final line of code.

A significant advantage of Qiskit is the visual representation provided by plot_histogram that can easily illustrate frequency probabilities.

Quantum Computing continues to be a highly intriguing field, and with Shor's Algorithm leading the way, the future looks promising. Algorithms like Shor's not only redefine computation speed but also encourage further advancements in the quantum realm.

Note: Running the above code requires a fair understanding of Quantum Physics principles and you should refer to Qiskit's documentation before trying out the experiment.