Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
#Mathematica, 118117 bytes
If[#==1,{0,1},#&@@SortBy[(S=Select)[S[Range[0,s=#]~Tuples~2,#<#2&@@#&]Less@@#&],!FreeQ[LinearRecurrence[{1,1},#,s],s]&],Mean]]&
#Mathematica, 118 bytes
If[#==1,{0,1},#&@@SortBy[(S=Select)[S[Range[0,s=#]~Tuples~2,#<#2&@@#&],!FreeQ[LinearRecurrence[{1,1},#,s],s]&],Mean]]&
#Mathematica, 117 bytes
If[#==1,{0,1},#&@@SortBy[(S=Select)[S[Range[0,s=#]~Tuples~2,Less@@#&],!FreeQ[LinearRecurrence[{1,1},#,s],s]&],Mean]]&
#Mathematica, 148118 bytes
(a=Join@@Table[{j,i},{i,#}If[#==1,{j,0,i-1}];d=z=1;If[#==1,#&@@a#&@@SortBy[(S=Select)[S[Range[0,While[d!=#s=#]~Tuples~2,t=1;While[(s=#&@@LinearRecurrence[#<#2&@@#&],!FreeQ[LinearRecurrence[{1,1},a[[z]]#,{t++}])<=#s],d=s];z++];a[[z-1]]])&s]&],Mean]]&
#Mathematica, 148 bytes
(a=Join@@Table[{j,i},{i,#},{j,0,i-1}];d=z=1;If[#==1,#&@@a,While[d!=#,t=1;While[(s=#&@@LinearRecurrence[{1,1},a[[z]],{t++}])<=#,d=s];z++];a[[z-1]]])&