#K75587. GCD Pair Finder
GCD Pair Finder
GCD Pair Finder
Given an array of integers, determine if there exists at least one pair of distinct elements such that their greatest common divisor (GCD) is greater than 1. Mathematically, given an array (A = [a_1, a_2, \dots, a_n]), you need to decide whether there exist indices (i < j) for which (\gcd(a_i,a_j) > 1).
If such a pair exists, print True
; otherwise, print False
.
inputFormat
The first line of input contains an integer (n) representing the number of elements in the array.
The second line contains (n) space-separated integers (a_1, a_2, \dots, a_n).
outputFormat
Output a single line: True
if there exists at least one pair of distinct elements in the array whose GCD is greater than 1; otherwise, output False
.## sample
4
5 10 15 20
True