



import unittest

from transformers.testing_utils import CaptureStdout
from transformers.tools.python_interpreter import evaluate



def 			_lowerCAmelCase       (					__lowerCAmelCase      )   ->					str:


				"""simple docstring"""

				return x + 2





class       a							(			unittest.TestCase				):



		def 	__lowerCamelCase			(     self     :Union[str, Any]  ):
						snake_case__	:      Any     		=	'''x = 3'''
						snake_case__	:      Any     		=	{}
						snake_case__	:      Optional[int]     		=	evaluate(__lowercase   ,{}   ,state=__lowercase  )
						assert result == 3
						self.assertDictEqual(__lowercase   ,{'''x''': 3}  )

						snake_case__	:      Dict     		=	'''x = y'''
						snake_case__	:      int     		=	{'''y''': 5}
						snake_case__	:      Dict     		=	evaluate(__lowercase   ,{}   ,state=__lowercase  )
						# evaluate returns the value of the last assignment.
						assert result == 5
						self.assertDictEqual(__lowercase   ,{'''x''': 5, '''y''': 5}  )



		def 	__lowerCamelCase			(     self     :Union[str, Any]  ):
						snake_case__	:      List[str]     		=	'''y = add_two(x)'''
						snake_case__	:      List[str]     		=	{'''x''': 3}
						snake_case__	:      Optional[Any]     		=	evaluate(__lowercase   ,{'''add_two''': add_two}   ,state=__lowercase  )
						assert result == 5
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''y''': 5}  )

						# Won't work without the tool
						with CaptureStdout() as out:
										snake_case__	:      Union[str, Any]     		=	evaluate(__lowercase   ,{}   ,state=__lowercase  )
						assert result is None
						assert "tried to execute add_two" in out.out



		def 	__lowerCamelCase			(     self     :Optional[int]  ):
						snake_case__	:      Any     		=	'''x = 3'''
						snake_case__	:      List[str]     		=	{}
						snake_case__	:      str     		=	evaluate(__lowercase   ,{}   ,state=__lowercase  )
						assert result == 3
						self.assertDictEqual(__lowercase   ,{'''x''': 3}  )



		def 	__lowerCamelCase			(     self     :List[Any]  ):
						snake_case__	:      Tuple     		=	'''test_dict = {\'x\': x, \'y\': add_two(x)}'''
						snake_case__	:      Union[str, Any]     		=	{'''x''': 3}
						snake_case__	:      List[str]     		=	evaluate(__lowercase   ,{'''add_two''': add_two}   ,state=__lowercase  )
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''y''': 5}  )
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''test_dict''': {'''x''': 3, '''y''': 5}}  )



		def 	__lowerCamelCase			(     self     :List[Any]  ):
						snake_case__	:      List[Any]     		=	'''x = 3\ny = 5'''
						snake_case__	:      Optional[Any]     		=	{}
						snake_case__	:      str     		=	evaluate(__lowercase   ,{}   ,state=__lowercase  )
						# evaluate returns the value of the last assignment.
						assert result == 5
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''y''': 5}  )



		def 	__lowerCamelCase			(     self     :Tuple  ):
						snake_case__	:      Any     		=	'''text = f\'This is x: {x}.\''''
						snake_case__	:      Optional[int]     		=	{'''x''': 3}
						snake_case__	:      Optional[int]     		=	evaluate(__lowercase   ,{}   ,state=__lowercase  )
						# evaluate returns the value of the last assignment.
						assert result == "This is x: 3."
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''text''': '''This is x: 3.'''}  )



		def 	__lowerCamelCase			(     self     :str  ):
						snake_case__	:      Any     		=	'''if x <= 3:\n    y = 2\nelse:\n    y = 5'''
						snake_case__	:      List[Any]     		=	{'''x''': 3}
						snake_case__	:      List[str]     		=	evaluate(__lowercase   ,{}   ,state=__lowercase  )
						# evaluate returns the value of the last assignment.
						assert result == 2
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''y''': 2}  )

						snake_case__	:      Dict     		=	{'''x''': 8}
						snake_case__	:      Optional[Any]     		=	evaluate(__lowercase   ,{}   ,state=__lowercase  )
						# evaluate returns the value of the last assignment.
						assert result == 5
						self.assertDictEqual(__lowercase   ,{'''x''': 8, '''y''': 5}  )



		def 	__lowerCamelCase			(     self     :Dict  ):
						snake_case__	:      Dict     		=	'''test_list = [x, add_two(x)]'''
						snake_case__	:      Dict     		=	{'''x''': 3}
						snake_case__	:      str     		=	evaluate(__lowercase   ,{'''add_two''': add_two}   ,state=__lowercase  )
						self.assertListEqual(__lowercase   ,[3, 5]  )
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''test_list''': [3, 5]}  )



		def 	__lowerCamelCase			(     self     :str  ):
						snake_case__	:      List[Any]     		=	'''y = x'''
						snake_case__	:      List[Any]     		=	{'''x''': 3}
						snake_case__	:      str     		=	evaluate(__lowercase   ,{}   ,state=__lowercase  )
						assert result == 3
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''y''': 3}  )



		def 	__lowerCamelCase			(     self     :str  ):
						snake_case__	:      Dict     		=	'''test_list = [x, add_two(x)]\ntest_list[1]'''
						snake_case__	:      Optional[Any]     		=	{'''x''': 3}
						snake_case__	:      Any     		=	evaluate(__lowercase   ,{'''add_two''': add_two}   ,state=__lowercase  )
						assert result == 5
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''test_list''': [3, 5]}  )

						snake_case__	:      List[str]     		=	'''test_dict = {\'x\': x, \'y\': add_two(x)}\ntest_dict[\'y\']'''
						snake_case__	:      Dict     		=	{'''x''': 3}
						snake_case__	:      Union[str, Any]     		=	evaluate(__lowercase   ,{'''add_two''': add_two}   ,state=__lowercase  )
						assert result == 5
						self.assertDictEqual(__lowercase   ,{'''x''': 3, '''test_dict''': {'''x''': 3, '''y''': 5}}  )






		def 	__lowerCamelCase			(     self     :List[str]  ):
						snake_case__	:      Tuple     		=	'''x = 0\nfor i in range(3):\n    x = i'''
						snake_case__	:      Tuple     		=	{}
						snake_case__	:      List[Any]     		=	evaluate(__lowercase   ,{'''range''': range}   ,state=__lowercase  )
						assert result == 2
						self.assertDictEqual(__lowercase   ,{'''x''': 2, '''i''': 2}  )






import random

from .binary_exp_mod import bin_exp_mod



def 			_lowerCAmelCase       (					__lowerCAmelCase  ,  __lowerCAmelCase=1000      )   ->					str:


				"""simple docstring"""

				if n < 2:
								return False

				if n % 2 == 0:
								return n == 2

				# this means n is odd
				snake_case__	:      Tuple     		=	n - 1
				snake_case__	:      Tuple     		=	0
				while d % 2 == 0:
								d /= 2
								exp += 1

				# n - 1=d*(2**exp)
				snake_case__	:      List[str]     		=	0
				while count < prec:
								snake_case__	:      List[str]     		=	random.randint(2  ,  n - 1      )
								snake_case__	:      Optional[Any]     		=	bin_exp_mod(__lowerCAmelCase  ,  __lowerCAmelCase  ,  __lowerCAmelCase      )
								if b != 1:
												snake_case__	:      List[Any]     		=	True
												for _ in range(__lowerCAmelCase      ):
																if b == n - 1:
																				snake_case__	:      List[str]     		=	False
																				break
																snake_case__	:      str     		=	b * b
																b %= n
												if flag:
																return False
												count += 1
				return True


if __name__ == "__main__":
				A__								=						abs(int(input('''Enter bound : ''').strip()))
				print('''Here\'s the list of primes:''')
				print(''', '''.join(str(i) for i in range(n + 1) if is_prime_big(i)))

