



import math

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






def 				A				(					_lowerCamelCase = 3  ):





							'''simple docstring'''




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

							_lowerCAmelCase     :							int    =    QuantumRegister(snake_case_				, "qr"  )
							_lowerCAmelCase     :							Union[str, Any]    =    ClassicalRegister(snake_case_				, "cr"  )

							_lowerCAmelCase     :							int    =    QuantumCircuit(snake_case_				, snake_case_  )

							_lowerCAmelCase     :							List[Any]    =    number_of_qubits

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

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

							# measure all the qubits
							quantum_circuit.measure(snake_case_				, snake_case_  )
							# simulate with 10000 shots
							_lowerCAmelCase     :							str    =    Aer.get_backend("qasm_simulator"  )
							_lowerCAmelCase     :							int    =    execute(snake_case_				, snake_case_				, shots=10_000  )

							return job.result().get_counts(snake_case_  )


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







from math import loga






def lowerCamelCase__    (							snake_case_	:  int       )      ->				int:
   if a < 0:
      raise ValueError('''Input value must be a positive integer'''       )
   elif isinstance(snake_case_       ,      snake_case_       ):
      raise TypeError('''Input value must be a \'int\' type'''       )
   return 0 if (a == 0) else int(loga(a & -a       )       )


if __name__ == "__main__":
    import doctest

    doctest.testmod()

