input: Write a function to find the largest prime factor of a given number. If the number is negative or zero, return None. If the input number is prime, return the number itself.
  assert largest_prime_factor(331)==331
  assert largest_prime_factor(13195)==29
  assert largest_prime_factor(600851475143)==6857
  assert largest_prime_factor(0)==None
  assert largest_prime_factor(-10)==None
output: def largest_prime_factor(n):
      if n <= 0:
          return None
      def is_prime(num):
          if num <= 1:
              return False
          for i in range(2, int(num**0.5) + 1):
              if num % i == 0:
                  return False
          return True
      if is_prime(n):
          return n
      largest = 1
      for i in range(2, int(n**0.5) + 1):
          while n % i == 0:
              largest = i
              n //= i
      if n > 1:
          largest = n
      return largest