Goldenness of an integer
Pyth - 24 23 bytes
There has to be a better way to find the divisors...
ho.a-.n3cFNfsIeTm,dcQdS
Test Suite.
Matlab, 96 81 bytes
Golfed (-15bytes), props to Luis Mendo
function w(n);a=find(~(mod(n,1:n)));[~,c]=min(abs(a./(n./a)-1.618));[a(c) n/a(c)]
Original:
function w(n)
a=find(not(mod(n,1:n)));b=abs(a./(n./a)-1.618);c=find(not(b-min(b)));[a(c) n/a(c)]
This is by far not a great solution, but my first attempt at code-golf. What fun!
Jelly, 16 15 14 bytes
Saved 1 byte thanks to @miles.
÷/ạØp
ÆDżṚ$ÇÞḢ
Try it online!
Explanation
÷/ạØp Helper link, calculates abs(a/b - phi). Argument: [a, b]
÷/ Reduce by division to calculate a/b.
ạØp Calculate abs(a/b - phi).
ÆDżṚ$ÇÞḢ Main link. Argument: n
ÆD Get divisors of n.
żṚ$ Pair the items of the list with those of its reverse. The reversed
divisors of a number is the same list as the number divided by each
of the divisors.
ÇÞ Sort by the output of the helper link of each pair.
Ḣ Get the first element [a, b] and implicitly print.