

import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute
def 						UpperCamelCase_(			snake_case__:  float = np.pi / 2  ,    snake_case__:  float = np.pi / 2  ,    snake_case__:  float = np.pi / 2   )       -> qiskit.result.counts.Counts:
 UpperCAmelCase__							=				QuantumRegister(3  ,    'qr'   )  # Define the number of quantum bits
 UpperCAmelCase__							=				ClassicalRegister(1  ,    'cr'   )  # Define the number of classical bits

 UpperCAmelCase__							=				QuantumCircuit(snake_case__  ,    snake_case__   )  # Define the quantum circuit.

 # Build the circuit
 quantum_circuit.u(snake_case__  ,    snake_case__  ,    snake_case__  ,    0   )  # Quantum State to teleport
 quantum_circuit.h(1   )  # add hadamard gate
 quantum_circuit.cx(
     1  ,    2   )  # add control gate with qubit 1 as control and 2 as target.
 quantum_circuit.cx(0  ,    1   )
 quantum_circuit.h(0   )
 quantum_circuit.cz(0  ,    2   )  # add control z gate.
 quantum_circuit.cx(1  ,    2   )

 quantum_circuit.measure([2]  ,    [0]   )  # measure the qubit.

 # Simulate the circuit using qasm simulator
 UpperCAmelCase__							=				Aer.get_backend('aer_simulator'   )
 UpperCAmelCase__							=				execute(snake_case__  ,    snake_case__  ,    shots=10_00   )

 return job.result().get_counts(snake_case__   )


if __name__ == "__main__":
 print(
     '''Total count for teleported state is: '''
     F"""{quantum_teleportation(np.pi/2, np.pi/2, np.pi/2)}"""
 )






from __future__ import annotations

from collections.abc import Generator



def    UpperCamelCase(					lowercase_							)	->				Generator[int, None, None]:





  '''simple docstring'''





  if not isinstance(lowercase_			,					lowercase_							) or n < 1:
    raise Exception("""Sequence only defined for positive integers"""							)

  yield n
  while n != 1:
    if n % 2 == 0:
      n //= 2
    else:
      snake_case_       						=      3 * n + 1
    yield n



def    UpperCamelCase(					)	->				Optional[int]:





  '''simple docstring'''





  snake_case_       						=      43
  snake_case_       						=      tuple(collatz_sequence(lowercase_							)							)
  print(lowercase_							)
  print(f'''Collatz sequence from {n} took {len(lowercase_							)} steps.'''							)


if __name__ == "__main__":
    main()