


'''simple docstring'''
import math

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

def 					lowerCamelCase_ ( __UpperCamelCase					:       int = 3		)					->	qiskit.result.counts.Counts:







     """simple docstring"""
     if isinstance(__UpperCamelCase							,    __UpperCamelCase		):
          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(__UpperCamelCase		) != number_of_qubits:
          raise ValueError('number of qubits must be exact integer.'		)
     if number_of_qubits > 1_0:
          raise ValueError('number of qubits too large to simulate(>10).'		)

     _A				=							QuantumRegister(__UpperCamelCase							,    'qr'		)
     _A				=							ClassicalRegister(__UpperCamelCase							,    'cr'		)

     _A				=							QuantumCircuit(__UpperCamelCase							,    __UpperCamelCase		)

     _A				=							number_of_qubits

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

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

     # measure all the qubits
     quantum_circuit.measure(__UpperCamelCase							,    __UpperCamelCase		)
     # simulate with 10000 shots
     _A				=							Aer.get_backend('qasm_simulator'		)
     _A				=							execute(__UpperCamelCase							,    __UpperCamelCase							,    shots=1_0_0_0_0		)

     return job.result().get_counts(__UpperCamelCase		)


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









'''simple docstring'''
def 					lowerCamelCase_ ( __UpperCamelCase					:       int		)					->	bool:







     """simple docstring"""
     if num < 0:
          return False

     _A				=							num
     _A				=							0
     while num > 0:
          _A				=							rev_num * 1_0 + (num % 1_0)
          num //= 1_0

     return num_copy == rev_num


if __name__ == "__main__":
    import doctest

    doctest.testmod()





