#Pyth, 21 20 18 bytes
Pyth, 21 20 18 bytes
hoacFN.n3C_Bf!%QTS ###Explanation
Explanation
- Get the inclu
Sive range from 1 to input. filter for numbers for that divide the input!%QT.- Get
[that list, that list reversed]_B. The reversed divisors of a number is the same list as the number divided by each of the divisors. - Transpose the list to get pairs of
[numerator, denominator]. - S
ort the pairs by theabsolute difference of the ratio of the paircFNand the golden ratio.n3. - Get the first (lowest) pair
hand print.