Given an array nums, compute the sum of gcd(nums[i], nums[j]) for all pairs i < j.
Example: nums = [2, 4, 8]. Pairs: (2,4) gcd=2, (2,8) gcd=2, (4,8) gcd=4. Sum = 2 + 2 + 4 = 8.
Constraints: 1 ≤ nums.length ≤ 1000, 1 ≤ nums[i] ≤ 1000. Try brute force first, then think if there is a better way.