

"""simple docstring"""




from __future__ import annotations



def 	UpperCAmelCase__   (				A__	,    A__	,    A__	,    A__   )      ->      None:




   """simple docstring"""
   if (direction == 1 and array[indexa] > array[indexa]) or (
       direction == 0 and array[indexa] < array[indexa]
   ):
      lowerCamelCase__					,       lowerCamelCase__						=			array[indexa], array[indexa]



def 	UpperCAmelCase__   (				A__	,    A__	,    A__	,    A__   )      ->      None:




   """simple docstring"""
   if length > 1:
      lowerCamelCase__						=			int(length / 2   )
      for i in range(A__	,    low + middle   ):
         comp_and_swap(A__	,    A__	,    i + middle	,    A__   )
      bitonic_merge(A__	,    A__	,    A__	,    A__   )
      bitonic_merge(A__	,    low + middle	,    A__	,    A__   )



def 	UpperCAmelCase__   (				A__	,    A__	,    A__	,    A__   )      ->      None:




   """simple docstring"""
   if length > 1:
      lowerCamelCase__						=			int(length / 2   )
      bitonic_sort(A__	,    A__	,    A__	,    1   )
      bitonic_sort(A__	,    low + middle	,    A__	,    0   )
      bitonic_merge(A__	,    A__	,    A__	,    A__   )


if __name__ == "__main__":
     SCREAMING_SNAKE_CASE_     :			Dict	  =			input('''Enter numbers separated by a comma:\n''').strip()
     SCREAMING_SNAKE_CASE_     :			Optional[int]	  =			[int(item.strip()) for item in user_input.split(''',''')]

     bitonic_sort(unsorted, 0, len(unsorted), 1)
     print('''\nSorted array in ascending order is: ''', end='''''')
     print(*unsorted, sep=''', ''')

     bitonic_merge(unsorted, 0, len(unsorted), 0)
     print('''Sorted array in descending order is: ''', end='''''')
     print(*unsorted, sep=''', ''')







"""simple docstring"""




def 	UpperCAmelCase__   (				A__   )      ->      list[int]:




   """simple docstring"""

   if num <= 0:
      raise ValueError("Input must be a positive integer"   )

   lowerCamelCase__						=			[True] * (num + 1)

   lowerCamelCase__						=			2
   while p * p <= num:
      if primes[p]:
         for i in range(p * p	,    num + 1	,    A__   ):
            lowerCamelCase__						=			False
      p += 1

   return [prime for prime in range(2	,    num + 1   ) if primes[prime]]


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     SCREAMING_SNAKE_CASE_     :			Optional[Any]	  =			int(input('''Enter a positive integer: ''').strip())
     print(prime_sieve_eratosthenes(user_num))




