Question: Do this problem in C++. Provide proper commenting (this is crucial) and make sure it compiles and runs well with NO ERRORS. Write a function
Do this problem in C++. Provide proper commenting (this is crucial) and make sure it compiles and runs well with NO ERRORS. Write a function that takes as a parameter a list or vector and returns true if the elements in the list are pairwise coprime and false otherwise. For example, suppose the passed list is (10, 7, 33, 13). This list is pairwise coprime since GCD(10, 7) = GCD(10, 33) = GCD(10, 13) GCD = (7, 33) = GCD(7, 13) GCD(33, 13) = 1 so the function returns true. On the other hand, the list {2, 3, 6, 9} is not pairwise coprime since GCD(3, 6) = 3 so the function returns false. Note that pairwise coprimality is stronger than coprimality in general since GCD(2, 3, 6, 9) = 1 but as seen earlier {2, 3, 6, 9) is not pairwise coprime
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
