






"""simple docstring"""






import math

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute



def  __lowerCamelCase					(					lowerCAmelCase__ = 3				):
				if isinstance(lowerCAmelCase__       ,lowerCAmelCase__				):
								raise TypeError('number of qubits must be a integer.'				)
				if number_of_qubits <= 0:
								raise ValueError('number of qubits must be > 0.'				)
				if math.floor(lowerCAmelCase__				) != number_of_qubits:
								raise ValueError('number of qubits must be exact integer.'				)
				if number_of_qubits > 10:
								raise ValueError('number of qubits too large to simulate(>10).'				)

				A__							 =       QuantumRegister(lowerCAmelCase__       ,'qr'				)
				A__							 =       ClassicalRegister(lowerCAmelCase__       ,'cr'				)

				A__							 =       QuantumCircuit(lowerCAmelCase__       ,lowerCAmelCase__				)

				A__							 =       number_of_qubits

				for i in range(lowerCAmelCase__				):
								quantum_circuit.h(number_of_qubits - i - 1				)
								counter -= 1
								for j in range(lowerCAmelCase__				):
												quantum_circuit.cp(np.pi / 2 ** (counter - j)       ,lowerCAmelCase__       ,lowerCAmelCase__				)

				for k in range(number_of_qubits // 2				):
								quantum_circuit.swap(lowerCAmelCase__       ,number_of_qubits - k - 1				)

				# measure all the qubits
				quantum_circuit.measure(lowerCAmelCase__       ,lowerCAmelCase__				)
				# simulate with 10000 shots
				A__							 =       Aer.get_backend('qasm_simulator'				)
				A__							 =       execute(lowerCAmelCase__       ,lowerCAmelCase__       ,shots=1_0000				)

				return job.result().get_counts(lowerCAmelCase__				)


if __name__ == "__main__":
					print(
					    f'''Total count for quantum fourier transform state is: \
    {quantum_fourier_transform(3)}'''
					)










"""simple docstring"""






from maths.prime_check import is_prime



def  __lowerCamelCase					(					lowerCAmelCase__				):
				if not isinstance(lowerCAmelCase__       ,lowerCAmelCase__				):
								A__							 =       f'''Input value of [number={number}] must be an integer'''
								raise TypeError(lowerCAmelCase__				)
				if is_prime(lowerCAmelCase__				) and is_prime(number + 2				):
								return number + 2
				else:
								return -1


if __name__ == "__main__":
					import doctest

					doctest.testmod()


