



"""simple docstring"""
import qiskit


def 			_SCREAMING_SNAKE_CASE						(__lowerCAmelCase = 2							) ->						qiskit.result.counts.Counts:







  '''simple docstring'''


  lowercase_								= qubits

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

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

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

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

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

  # 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
  lowercase_								= qiskit.execute(__lowerCAmelCase ,  __lowerCAmelCase ,  shots=10_00							)

  return job.result().get_counts(__lowerCAmelCase							)


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






"""simple docstring"""
def 			_SCREAMING_SNAKE_CASE						(__lowerCAmelCase ,  __lowerCAmelCase							) ->						int:







  '''simple docstring'''


  while a != 0:
    lowercase_					,    lowercase_								= b % a, a
  return b


def 			_SCREAMING_SNAKE_CASE						(__lowerCAmelCase ,  __lowerCAmelCase							) ->						int:







  '''simple docstring'''


  if gcd(__lowerCAmelCase ,  __lowerCAmelCase							) != 1:
    lowercase_								= F'''mod inverse of {a!r} and {m!r} does not exist'''
    raise ValueError(__lowerCAmelCase							)
  lowercase_					,    lowercase_					,    lowercase_								= 1, 0, a
  lowercase_					,    lowercase_					,    lowercase_								= 0, 1, m
  while va != 0:
    lowercase_								= ua // va
    lowercase_					,    lowercase_					,    lowercase_					,    lowercase_					,    lowercase_					,    lowercase_								= (ua - q * va), (ua - q * va), (ua - q * va), va, va, va
  return ua % m

