

import random

from .binary_exp_mod import bin_exp_mod

def    A_  (							a					,   a=1_0_0_0  ):

      """simple docstring"""



      if n < 2:
            return False

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

      # this means n is odd
      SCREAMING_SNAKE_CASE_				:  int           =     n - 1
      SCREAMING_SNAKE_CASE_				:  List[str]           =     0
      while d % 2 == 0:
            d /= 2
            exp += 1

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


if __name__ == "__main__":
    lowerCAmelCase     :   int						     =  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)))









def    A_  (							a  ):

      """simple docstring"""



      if upper_limit < 0:
            raise ValueError('Limit for the Catalan sequence must be ≥ 0'  )

      SCREAMING_SNAKE_CASE_				:  List[str]           =     [0] * (upper_limit + 1)

      # Base case: C(0) = C(1) = 1
      SCREAMING_SNAKE_CASE_				:  Any           =     1
      if upper_limit > 0:
            SCREAMING_SNAKE_CASE_				:  int           =     1

      # Recurrence relation: C(i) = sum(C(j).C(i-j-1)), from j = 0 to i
      for i in range(2					,   upper_limit + 1  ):
            for j in range(a  ):
                  catalan_list[i] += catalan_list[j] * catalan_list[i - j - 1]

      return catalan_list


if __name__ == "__main__":
    print('\n********* Catalan Numbers Using Dynamic Programming ************\n')
    print('\n*** Enter -1 at any time to quit ***')
    print('\nEnter the upper limit (≥ 0) for the Catalan number sequence: ', end='')
    try:
        while True:
            lowerCAmelCase     :   Union[str, Any]						     =  int(input().strip())
            if N < 0:
                print('\n********* Goodbye!! ************')
                break
            else:
                print(F'The Catalan numbers from 0 through {N} are:')
                print(catalan_numbers(N))
                print('Try another upper limit for the sequence: ', end='')
    except (NameError, ValueError):
        print('\n********* Invalid input, goodbye! ************\n')

    import doctest

    doctest.testmod()






