def randomized_primality_testing(n, k):
 for _ in range(k):
  x = rsa.randnum.randint((n - 1))
  if jacobi_witness(x, n):
   return False
 return True

def randomized_primality_testing ( n , k ) : for _ in range ( k ) : x = rsa . randnum . randint ( ( n - 1 ) ) if jacobi_witness ( x , n ) : return False return True
calculates whether n is composite or prime returns false if the number is composite .