Quantum computing has gained a lot of interest recently because of its claims of solving some problems that are almost impossible solving in classical computing. Prime factorization of big numbers using Shor’s algorithm and Grover database search algorithm are two of them. Furthermore, quantum algorithms are developed to make it more realistic in real world. In classical computing the basic unit of computation is a bit which is in 0 or 1 state at a time, whereas in quantum computing it is called a qbit which can be 0 and 1 at the same time and we call it superposition. This paper proposes an implementation of quantum full adder using IBM quantum experience. Quantum circuits are drawn using Qiskit and run on Qiskit simulators, IBM quantum simulators and real IBM quantum machines. Proposed circuit will help in future for drawing more complex circuits and algorithms. 1 Introduction Addition is basic form of computation in computing. Classical computers perform addition using a circuit which is comprised of classical gates. Like in quantum computing we need a mechanism of adding numbers. This paper proposes a quantum circuit which is composed of quantum gates and can add any two numbers. IBM has launched a Software Development Kit(SDK) Qiskit for working with quantum computer at level of circuits, pulses and algorithms [3]. Qiskit provides tools for writing quantum programs and run them on real quantum machines and simulators. It uses python as a language to write quantum programs and has various simulators like Qasm-Simulator and state-vector simulator built into it. Quantum circuits run on local simulators, IBM simulators as well as quantum machines. Whereas, real quantum machines have some limitations like limited number of qbits and noise in quantum systems. IBM has provided an open access to its quantum systems up to 7 qbits. Google has also launched its SDK named cirq for working with quantum computers at level of cir- cuits and pulses. Programs written in cirq can run on their simulators built into its SDK. Some other SDKs like Ocean, ProjectQ, Forest and PennyLane are also available to write and run quantum programs.[9] IBM largest quantum computer available to run qiskit quantum programs is 127 qbit system [12]. Quantum computing is progressing day by day and more powerful quantum processors are built. IBM claims that they have developed 433 qbit IBM ”Osprey” processor and their road map says that they will develop 1121 qbit ”Condor” processor in 2023 [13]. But for now there are not many qbits available to be utilized so, available quantum systems need to be utilized up to their capacity. This paper proposes the idea to reduce the number of qbits from circuit and reuse qbits for performing computations. Therefore, a quantum full adder is implemented using only 3 qbits. Quantum computer uses state of qbit to represent any data while we can use this qbit as 0,1 or both 1 at the same time. In case of adding any two numbers we need qbit in a definite state either 0 or 1 that is why we can re-use the qbit once measured. The idea is to reduce the number of qbits and perform addition on quantum computers available using minimum resources. A generic approach is used to perform addition so that number of any size can be added and the quantum circuit adjusts to the size of a given number. The proposed idea is implemented in Qiskit and results are compiled on qiskit simulators, IBM simulators, and real quantum machines. The proposed algorithm is capable of adding two numbers of any size depending on the computational power of the machine. Results compiled from the algorithm are discussed later in the paper. Section 2 describes preliminary work on quantum full adders. Design and Implementation is dis- cussed in section 3 while section 4 describes the results compiled after executing the circuits. Con- clusions are made in section 5 of the document. 2 Preliminaries In this section many different approaches by different authors have been discussed for addition of numbers on quantum computers. Different authors have proposed different designs and ideas of adding numbers using quantum circuits. In ”Design and Implementation of quantum Half Adder and Full Adder using IBM Quantum Ex- perience” [1] authors proposed designs for quantum half adder and full adder. Full adder circuit consisting of four qbits with 2 inputs A and B and a carry In C along with and ancillary qbit. Proposed circuit has 2 CCX (Toffoli) gates and 3 CX gates. The author has focused on running quantum circuit on quantum machines and analyzing the probabilistic results. The proposed circuit has a total cost of 51 as the Toffoli gate has cost 13 and the CNOT gate has a cost of 5 [2]. In ”Design And Simulation Of Quantum Adder Using IBM Quantum Experience” [4] authors pro- posed a design and simulation for quantum full adder using two half adders. The author focused on the design and implementation of quantum gates. Full adder comprised of 5 qubits with 3 inputs and 2 ancillary qubits. The proposed design for full adder has the cost 51 [2]. In ”Quantum Most-Significant Digit-First Addition”[5] authors proposed different quantum full adder designs comprising 7, 5, and 4 qubits. The main focus of the author was on reducing the number of qubits. The author described quantum full adders based on Peres gate, V gate, and state reuse. Generally, adders are LSDF(Least Significant Digit First) while in this paper author has proposed a quantum full adder based on MSDF Most Significant Digit First). In ”Design of Quantum circuit for Full Adder using HNG Gate”[6]. Authors proposed a quantum full adder using an HNG gate. The basic circuit is composed of 4 qubits. Circuit takes 4 inputs and generates 4 possible outputs out of which 2 outputs are garbage values. The focus of the authors is on reducing the number of gates and quantum cost. There is no implementation discussed by the authors for the proposed design. The number of gates required to implement an HNG gate is 6. In ”Quantum dynamics for energetic advantage in a charge-based classical full-adder”[7] authors have proposed a design of quantum circuit for a classical full adder. The author focused on energy consumption and reducing the number of bits. Repeated Fredkin gate execution based on coherent dynamics of triple quantum dot system is used to build the full adder system. 5 qubits adder with Fredkin gates is reduced to 3 qubits full adders with 5 Fredkin gates and 1 SWAP gate. In ”Quantum full adder and subtractor ”[8] authors proposed a quantum full adder design consisting of 5 qubits for single-bit addition. The number of quantum gates required to build a circuit is 4n, where n is the number of bits to be added. For a 1-bit adder, the number of gates required is 4. The proposed circuit can be used recursively to perform n-bit addition with a 4 bits basic unit and 3 bits circuit for each extra bit where 1 bit of the previous circuit is being re-used. In ”Demonstration of a Quantum Calculator on IBM Quantum Experience Platform and its Appli- cation for Conversion of a Decimal Number to its Binary Representation” [10] authors have proposed a quantum calculator and running quantum circuits on real quantum machines. There is a total of 5 qubits used for basic 1-bit addition where A, B, and Carry-In along with 2 ancillary qubits are input and the circuit produces sum and carry-out along with 3 garbage values. In Fig. 1 design proposed in [1] involves 4 qubits for single-bit addition and it requires 3 CX and 2 2 Toffoli Gates for the addition of a single-bit number. To extend this circuit for the addition of numbers of more than 1 bit the minimum qubits required for each bit are 3. So, to extend this circuit to 2 bits number addition the gate cost would be 10, and the number of qubits required would be 7. Figure 1: Quantum Full Adder [1] 3 Design & Implementation As discussed in the Literature Review people have proposed many different approaches for quantum Full Adder implementation. The most common approach requires at least 4 qubits to add a single bit number and if extended to multiple bits addition the number of qubits increases to 3 qubits per single bit. For 4 bits number adder, we need at least 13 qubits, 4 qubits for a basic unit single-bit adder, and then 9 qubits for the other three bits (3 qubits per bit addition) one qubit will be reused from the previous circuit. In case of bigger numbers addition, we cannot run this circuit on the real quantum machine because of limited resources available. Whenever we need to add two numbers using Quantum Full Adder we first need to encode the classical bits in a quantum circuit and then run that circuit on a Quantum Computer or Simulator to get the results. All of these approaches require lots of resources that are not available at the individual level so we propose an alternative implementation using only 3 qubits. Using this approach we only need three qubits to add two numbers of any size. First, we create Quantum Circuit depending on our input and then run the circuit on qiskit simulators, IBM simulators, and IBM real quantum machines for results. Results compiled after running circuits are discussed in the later section of the paper. 3.1 Qiskit Qiskit is the library of python that is developed by IBM and is meant to code and create Quantum circuits and run these circuits on local simulators, IBM quantum simulators, or real IBM Quantum Computers. It has all the required gates that are required to create a full adder circuit. Following Quantum Gates are used to construct a Full Adder Circuit. 3.1.1 X Gate X gate is a single-qubit gate. It is generally known as a bit flip gate which flips the current state of a qubit. Fig. 2 shows how x gate is applied on a qubit and how the result is measured in qiskit. Figure 2: X Gate 3 3.1.2 CNOT Gate CNOT is a multi-qubit gate in which 1 qubit has control while the other one is the target qubit when the control qubit is 1 then it flips the state of the target qubit otherwise it remains unchanged. Fig. 3 shows how Controlled X gate is applied in qiskit. Figure 3: Controlled-X Gate 3.1.3 Toffoli Gate Toffoli gate is a multi-qubit gate that involves 3 qubits. The first two qubits are control and the third qubit is the target qubit. It behaves like a classical AND operation. Fig. 4 shows how the Toffoli gate is applied in qiskit. Figure 4: Toffoli Gate 3.2 Proposed Design Our proposed design is based on encoding binary logic onto the quantum states and adding any two binary numbers using quantum gates. Our proposed adder uses only 3 qubits to perform any two numbers addition based on the state reuse of a qubit. The proposed Circuit involves 3 CX and 2 Toffoli gates for single-bit addition. The number of gates required for any n bit numbers addition is 5n. Fig. 5 shows the design of a quantum full adder which involves only 3 qubits for the addition of 2 single-bit numbers addition where the qubit q0 is reused once measured for new input. Carry-in is taken on q1 while carry-out is measured on the same qubit and sum is measured on q2. Fig. 7 illustrates the design of 2 bits full adder which is an extended version of a single-bit adder that involves 10 gates and 3 qubits to add two numbers of two bits. Similarly, this design is extendable to any number of bits and the gate cost will be 5n where n is the number of bits. Fig. 6 shows the truth table for the full adder and our quantum full adder is tested for all inputs and results. 4 Results Results are compiled after running circuit on qiskit simulator, IBM quantum simulator and real quantum hardware as well. Fig. 8 shows results where the inputs are; a=1, b=1, and Cin=1 on the qiskit simulator. Fig. 8 below shows the result for the given input. Fig. 9 below shows the execution 4 Figure 5: Single Bit Full Adder Figure 6: Full Adder Truth Table result of the Full Adder circuit on a real quantum machine with 11 being the highest probability among the four possible outcomes When the inputs are; a=1, b=1, Cin=1. Proposed circuit is capable of adding any two decimal numbers as discussed in the section 3. Fig. 10 shows result of adding two decimal numbers i.e 3+1 on real quantum machine. Fig. 11 shows noise mitigated results for adding 3+1 on real quantum machine where the probability of the desired result increases and probability of noisy results decrease.[11] 5 Figure 7: Two Bits Full Adder Figure 8: Aer Simulator Single Bit Full Adder Result 5 Conclusion Quantum processors have limited number of qbits, Although quantum computing is growing day by day but right now it is limited to a small number of qbits. Latest available quantum processor developed by IBM right till now is 127 qubit Eagle processor and they are working to expand this to more number of qbits in future but this seems not very easy [12]. We proposed and implemented a new way of adding numbers using quantum circuits based on the re-usability of qbits. The circuits were run on qiskit simulators, IBM simulators and quantum machines as well and we got ideal results in case of simulators and some noisy results when running circuits on quantum machines. Noise mitigation techniques were also applied and results got better . In future this approach can be used for implementation of quantum subtraction, multiplication and division as well. Figure 9: Quantum Hardware Single Bit Full Adder Result 6 Figure 10: Adding 3+1 on Real Quantum Machine Figure 11: Noise Mitigation on Full Adder 7