"""simple docstring"""






from itertools import compress, repeat
from math import ceil, sqrt



def     a_		(   lowerCamelCase			):

				if num <= 2:
								return []
				if num == 3:
								return [2]

				# Odd sieve for numbers in range [3, num - 1]
				UpperCAmelCase__			 =				bytearray(b'\x01'			) * ((num >> 1) - 1)

				for i in range(3   ,     int(sqrt(lowerCamelCase			)			) + 1   ,     2			):
								if sieve[(i >> 1) - 1]:
												UpperCAmelCase__			 =				i**2
												UpperCAmelCase__			 =				repeat(
												    0   ,     ceil((num - i_squared) / (i << 1)			)			)

				return [2] + list(compress(range(3   ,     lowerCamelCase   ,     2			)   ,     lowerCamelCase			)			)


if __name__ == "__main__":
						import doctest

						doctest.testmod()




"""simple docstring"""






from __future__ import annotations



def     a_		(   lowerCamelCase			):
				for r in range(1   ,     lowerCamelCase			):
								UpperCAmelCase__			 =				[]
								for x in range(n - 1			):
												UpperCAmelCase__			 =				pow(lowerCamelCase   ,     lowerCamelCase   ,     lowerCamelCase			)
												if val in li:
																break
												li.append(lowerCamelCase			)
								else:
												return r
				return None


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

												lowerCAmelCase__    :    Union[str, Any]			=      pow(b_public, a_private, q)
												lowerCAmelCase__    :    Tuple			=      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)



