import math

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





def 				UpperCAmelCase						(    lowercase = 3							):







				"""simple docstring"""



				if isinstance(lowercase							,			lowercase							):
								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(lowercase							) != 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).'''							)

				__lowercase 			=							QuantumRegister(lowercase							,			'''qr'''							)
				__lowercase 			=							ClassicalRegister(lowercase							,			'''cr'''							)

				__lowercase 			=							QuantumCircuit(lowercase							,			lowercase							)

				__lowercase 			=							number_of_qubits

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

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

				# measure all the qubits
				quantum_circuit.measure(lowercase							,			lowercase							)
				# simulate with 10000 shots
				__lowercase 			=							Aer.get_backend('''qasm_simulator'''							)
				__lowercase 			=							execute(lowercase							,			lowercase							,			shots=10000							)

				return job.result().get_counts(lowercase							)


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





def 				UpperCAmelCase						(    lowercase							,			lowercase							):







				"""simple docstring"""



				__lowercase 			=							qiskit.Aer.get_backend('''aer_simulator'''							)

				# Create a Quantum Circuit acting on the q register
				__lowercase 			=							qiskit.QuantumCircuit(lowercase							,			lowercase							)

				# Map the quantum measurement to the classical bits
				circuit.measure([0]							,			[0]							)

				# Execute the circuit on the simulator
				__lowercase 			=							qiskit.execute(lowercase							,			lowercase							,			shots=1000							)

				# Return the histogram data of the results of the experiment.
				return job.result().get_counts(lowercase							)


if __name__ == "__main__":
		print(F'''Total count for various states are: {single_qubit_measure(1, 1)}''')