input: Write a Python function to find the greatest prime divisor of an integer n, where n > 1 and is composite. 
  assert largest_prime_factor(15) == 5
  assert largest_prime_factor(27) == 3
  assert largest_prime_factor(63) == 7
  assert largest_prime_factor(330) == 11
  assert largest_prime_factor(13195) == 29
output: 
  def largest_prime_factor(n):
      def is_prime(x):
          if x <= 1:
              return False
          if x <= 3:
              return True
          if x % 2 == 0 or x % 3 == 0:
              return False
          i = 5
          while i * i <= x:
              if x % i == 0 or x % (i + 2) == 0:
                  return False
              i += 6
          return True
      
      max_prime = 1
      while n % 2 == 0:
          max_prime = 2
          n //= 2
  
      factor = 3
      while factor * factor <= n:
          while n % factor == 0:
              if is_prime(factor):
                  max_prime = factor
              n //= factor
          factor += 2
  
      if n > 2 and is_prime(n):
          max_prime = n
      
      return max_prime
  