Easy and fast solution with mathematical explaination (beats > 99.7%)
Theorem. A necessary and sufficient condition for that the greatest common divisor (gcd) of n positive integers a_1, a_2, ..., a_n is 1 is that there exist n in
Theorem. A necessary and sufficient condition for that the *greatest common divisor* (gcd) of n positive integers a_1, a_2, ..., a_n is 1 is that there exist n integers b_1, b_2, ..., b_n such that\n*  b_1*a_1 + b_2*a_2 + ... + b_n*a_n = 1. (The proof is elementary.)\n\nTherefore, the problem here is equivalent to that if the gcd of the nums in the array is 1 or not. If it is 1, it is a good array; otherwise, not.\n\nMethod 1. Write the functions directly\n```\nclass Solution:\n    def isGoodArray(self, nums: List[int]) -> bool:\n        if not nums:\n            return False\n        if len(nums) == 1:\n            if nums[0] == 1:\n                return True\n            else:\n                return False\n        factor = self.gcd(nums[0], nums[1])\n        for num in nums[2:]:\n            factor = self.gcd(factor, num)\n        if factor == 1:\n            return True\n        else:\n            return False    \n        \n    def gcd(self, m, n):\n        if m > n:\n            m, n = n, m\n        if n % m == 0:\n            return m\n        else:\n            return self.gcd(n%m, m)\n```\nMethod 2. Use the built-in functions\n```\nfrom math import gcd\nfrom functools import reduce\nclass Solution:\n    def isGoodArray(self, nums: List[int]) -> bool:\n        return reduce(gcd, nums) == 1\n```
[]