Count the frequency of every possible gcd value in the range
for i in range ( l , r + 1 ) : NEW_LINE INDENT for j in range ( l , r + 1 ) : NEW_LINE INDENT frequency [ gcd ( i , j ) ] += 1 ; NEW_LINE DEDENT DEDENT