code: def composite(nth):
      """Return the nth composite number, with the composite numbers indexed as
      composite(1) = 4, composite(2) = 6, etc....
  
      Examples
      ========
  
      >>> from sympy import composite
      >>> composite(36)
      52
      >>> composite(1)
      4
      >>> composite(17737)
      20000
  
      See Also
      ========
  
      sympy.ntheory.primetest.isprime : Test if n is prime
      primerange : Generate all primes in a given range
      primepi : Return the number of primes less than or equal to n
      prime : Return the nth prime
      compositepi : Return the number of positive composite numbers less than or equal to n
      """
      n = as_int(nth)
      if n < 1:
          raise ValueError(
              "nth must be a positive integer; composite(1) == 4"
          )
      composite_arr = [4, 6, 8, 9, 10, 12, 14, 15, 16, 18]
      if n <= 10:
          return composite_arr[n - 1]
  
      a, b = 4, sieve._list[-1]
      if n <= b - primepi(b) - 1:
          while a < b - 1:
              mid = (a + b) >> 1
              if mid - primepi(mid) - 1 > n:
                  b = mid
              else:
                  a = mid
          if isprime(a):
              a -= 1
          return a
  
      from sympy.functions.elementary.exponential import log
      from sympy.functions.special.error_functions import li
  
      a = 4  # Lower bound for binary search
      b = int(n * (log(n) + log(log(n))))  # Upper bound for the search.
  
      while a < b:
          mid = (a + b) >> 1
          if mid - li(mid) - 1 > n:
              b = mid
          else:
              a = mid + 1
  
      n_composites = a - primepi(a) - 1
      while n_composites > n:
          if not isprime(a):
              n_composites -= 1
          a -= 1
      if isprime(a):
          a -= 1
      return a
  
imports: from bisect import bisect, bisect_left
  from itertools import count
  from array import array
  from sympy.core.function import Function
  from sympy.core.random import randint
  from sympy.core.singleton import S
  from sympy.external.gmpy import sqrt
  from .primetest import isprime
  from sympy.utilities.misc import as_int
label_desc: Use image node_id 9 for calling a global function with example usage: composite(nth) and returns: a, composite_arr, a