

'''simple docstring'''


import math

import qiskit




def 	_a       (				__lowerCAmelCase		:      Dict = 1   ,							__lowerCAmelCase		:      List[str] = 1   ,							__lowerCAmelCase		:      Optional[Any] = 1     ):

		"""simple docstring"""

		if (
		    isinstance(SCREAMING_SNAKE_CASE_   ,							SCREAMING_SNAKE_CASE_     )
		    or isinstance(SCREAMING_SNAKE_CASE_   ,							SCREAMING_SNAKE_CASE_     )
		    or isinstance(SCREAMING_SNAKE_CASE_   ,							SCREAMING_SNAKE_CASE_     )
		):
				raise TypeError('''inputs must be integers.'''     )

		if (input_a < 0) or (input_a < 0) or (carry_in < 0):
				raise ValueError('''inputs must be positive.'''     )

		if (
		    (math.floor(SCREAMING_SNAKE_CASE_     ) != input_a)
		    or (math.floor(SCREAMING_SNAKE_CASE_     ) != input_a)
		    or (math.floor(SCREAMING_SNAKE_CASE_     ) != carry_in)
		):
				raise ValueError('''inputs must be exact integers.'''     )

		if (input_a > 2) or (input_a > 2) or (carry_in > 2):
				raise ValueError('''inputs must be less or equal to 2.'''     )

		# build registers
		snake_case__						:       Dict       						=  qiskit.QuantumRegister(4   ,							'''qr'''     )
		snake_case__						:       Tuple       						=  qiskit.ClassicalRegister(2   ,							'''cr'''     )
		# list the entries
		snake_case__						:       Any       						=  [input_a, input_a, carry_in]

		snake_case__						:       str       						=  qiskit.QuantumCircuit(SCREAMING_SNAKE_CASE_   ,							SCREAMING_SNAKE_CASE_     )

		for i in range(0   ,							3     ):
				if entry[i] == 2:
						quantum_circuit.h(SCREAMING_SNAKE_CASE_     )  # for hadamard entries
				elif entry[i] == 1:
						quantum_circuit.x(SCREAMING_SNAKE_CASE_     )  # for 1 entries
				elif entry[i] == 0:
						quantum_circuit.i(SCREAMING_SNAKE_CASE_     )  # for 0 entries

    # build the circuit
		quantum_circuit.ccx(0   ,							1   ,							3     )  # ccx = toffoli gate
		quantum_circuit.cx(0   ,							1     )
		quantum_circuit.ccx(1   ,							2   ,							3     )
		quantum_circuit.cx(1   ,							2     )
		quantum_circuit.cx(0   ,							1     )

		quantum_circuit.measure([2, 3]   ,							SCREAMING_SNAKE_CASE_     )  # measure the last two qbits

		snake_case__						:       int       						=  qiskit.Aer.get_backend('''aer_simulator'''     )
		snake_case__						:       Optional[Any]       						=  qiskit.execute(SCREAMING_SNAKE_CASE_   ,							SCREAMING_SNAKE_CASE_   ,							shots=10_00     )

		return job.result().get_counts(SCREAMING_SNAKE_CASE_     )


if __name__ == "__main__":
					print(f"""Total sum count for state is: {quantum_full_adder(1, 1, 1)}""")






'''simple docstring'''


def 	_a       (				__lowerCAmelCase		:      int     ):

		"""simple docstring"""

		if p < 2:
				raise ValueError('''p should not be less than 2!'''     )
		elif p == 2:
				return True

		snake_case__						:       Any       						=  4
		snake_case__						:       int       						=  (1 << p) - 1
		for _ in range(p - 2     ):
				snake_case__						:       Tuple       						=  ((s * s) - 2) % m
		return s == 0


if __name__ == "__main__":
					print(lucas_lehmer_test(7))
					print(lucas_lehmer_test(11))



