input: Write a function to find the largest prime factor of a given number. If the number is empty or less than 2, return None.
  assert largest_prime_factor(331)==331
  assert largest_prime_factor(13195)==29
  assert largest_prime_factor(600851475143)==6857
  assert largest_prime_factor(1)==None
  assert largest_prime_factor(-5)==None
  assert largest_prime_factor(0)==None
  assert largest_prime_factor([])==None
output: def largest_prime_factor(n):
      if not n or n < 2:
          return None
      
      def is_prime(num):
          if num < 2:
              return False
          for i in range(2, int(num**0.5) + 1):
              if num % i == 0:
                  return False
          return True
      
      largest_factor = None
      for i in range(2, int(n**0.5) + 1):
          if n % i == 0:
              if is_prime(i):
                  largest_factor = i
              if is_prime(n // i):
                  return n // i
      
      return largest_factor if largest_factor else n