
import qiskit





def      lowerCamelCase_					(							lowerCamelCase__ = 2       ):
				lowerCamelCase_         =     qubits

				# Using Aer's simulator
				lowerCamelCase_         =     qiskit.Aer.get_backend("aer_simulator"       )

				# Creating a Quantum Circuit acting on the q register
				lowerCamelCase_         =     qiskit.QuantumCircuit(_UpperCamelCase      ,					_UpperCamelCase       )

				# Adding a H gate on qubit 0 (now q0 in superposition)
				circuit.h(0       )

				for i in range(1      ,					_UpperCamelCase       ):
								# Adding CX (CNOT) gate
								circuit.cx(i - 1      ,					_UpperCamelCase       )

				# Mapping the quantum measurement to the classical bits
				circuit.measure(list(range(_UpperCamelCase       )       )      ,					list(range(_UpperCamelCase       )       )       )

				# Now measuring any one qubit would affect other qubits to collapse
				# their super position and have same state as the measured one.

				# Executing the circuit on the simulator
				lowerCamelCase_         =     qiskit.execute(_UpperCamelCase      ,					_UpperCamelCase      ,					shots=1_0_0_0       )

				return job.result().get_counts(_UpperCamelCase       )


if __name__ == "__main__":
			print(F"""Total count for various states are: {quantum_entanglement(3)}""")










def 		lowercase__  (				_UpperCamelCase) ->			list:
      """simple docstring"""

      if bit_count < 0:
            raise ValueError('The given input must be positive')

      # get the generated string sequence
      UpperCamelCase					       =  gray_code_sequence_string(_UpperCamelCase)
      #
      # convert them to integers
      for i in range(len(_UpperCamelCase)):
            UpperCamelCase					       =  int(sequence[i]       ,							2)

      return sequence
def 		lowercase__  (				_UpperCamelCase) ->			list:
      """simple docstring"""

      if bit_count == 0:
            return ["0"]

      if bit_count == 1:
            return ["0", "1"]

      UpperCamelCase					       =  1 << bit_count  # defines the length of the sequence
      # 1<< n is equivalent to 2^n

      # recursive answer will generate answer for n-1 bits
      UpperCamelCase					       =  gray_code_sequence_string(bit_count - 1)

      UpperCamelCase					       =  []

      # append 0 to first half of the smaller sequence generated
      for i in range(seq_len // 2):
            UpperCamelCase					       =  '0' + smaller_sequence[i]
            sequence.append(_UpperCamelCase)

      # append 1 to second half ... start from the end of the list
      for i in reversed(range(seq_len // 2)):
            UpperCamelCase					       =  '1' + smaller_sequence[i]
            sequence.append(_UpperCamelCase)

      return sequence


if __name__ == "__main__":
       import doctest

       doctest.testmod()



