Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#Matlab, 96 81 bytes Golfed (-15bytes), props to [Luis Mendo] 11

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!

#Matlab, 96 81 bytes Golfed (-15bytes), props to [Luis Mendo] 1

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!

#Matlab, 96 81 bytes Golfed (-15bytes), props to [Luis Mendo] 1

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!

added 210 characters in body
Source Link
ptev
  • 111
  • 5

#Matlab, 9696 81 bytes Golfed (-15bytes), props to [Luis Mendo] 1

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!

#Matlab, 96 bytes

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!

#Matlab, 96 81 bytes Golfed (-15bytes), props to [Luis Mendo] 1

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!

Nitpicking on formatting
Source Link
DJMcMayhem
  • 60.1k
  • 18
  • 203
  • 352

Matlab#Matlab, 96 bytes

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!

Matlab, 96 bytes

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!

#Matlab, 96 bytes

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!

Source Link
ptev
  • 111
  • 5
Loading