GCD and LCM
Your task
Given a list of positive integers (length 1..1000, each value 1..10^9), return [g, l] where g is the GCD of all of them and l is the LCM of all of them, with l reduced modulo 10^9+7 (the true LCM can be astronomically large). Compute LCM incrementally as a*b//gcd(a,b) on the true integers, then take the answer mod 10^9+7 at the end.
Examples
gcd_lcm_all(nums: list[int]) -> list[int]Example 1
Input
gcd_lcm_all([4, 6, 8])Output
[2, 24]