


"""simple docstring"""






from __future__ import annotations


def __lowercase  (   lowerCamelCase_	:   int	):
				for r in range(1    ,       lowerCamelCase_	):
								SCREAMING_SNAKE_CASE__  				=					[]
								for x in range(n - 1	):
												SCREAMING_SNAKE_CASE__  				=					pow(lowerCamelCase_    ,       lowerCamelCase_    ,       lowerCamelCase_	)
												if val in li:
																break
												li.append(lowerCamelCase_	)
								else:
												return r
				return None


if __name__ == "__main__":
	_lowerCamelCase  =	int(input('Enter a prime number q: '))
	_lowerCamelCase  =	find_primitive(q)
	if a is None:
		print(f"""Cannot find the primitive for the value: {a!r}""")
	else:
		_lowerCamelCase  =	int(input('Enter private key of A: '))
		_lowerCamelCase  =	pow(a, a_private, q)
		_lowerCamelCase  =	int(input('Enter private key of B: '))
		_lowerCamelCase  =	pow(a, b_private, q)

		_lowerCamelCase  =	pow(b_public, a_private, q)
		_lowerCamelCase  =	pow(a_public, b_private, q)

		print('The key value generated by A is: ', a_secret)
		print('The key value generated by B is: ', b_secret)




"""simple docstring"""






from __future__ import annotations

from collections.abc import Generator


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

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


def __lowercase  (   ):
				SCREAMING_SNAKE_CASE__  				=					43
				SCREAMING_SNAKE_CASE__  				=					tuple(collatz_sequence(lowerCamelCase_	)	)
				print(lowerCamelCase_	)
				print(F'''Collatz sequence from {n} took {len(lowerCamelCase_	)} steps.'''	)


if __name__ == "__main__":
	main()
