From: John Carter Date: 2007-03-20T08:26:35+09:00 Subject: Re: Golfing the Farey Sequence On Tue, 20 Mar 2007, John Carter wrote: > Ooh. Wait, there is a very very cheap shot available... > a,b,c,d=0,1,1,7 > puts "#{a}/#{b}" > while c<7 > k = (N+b)/d > e = k*c-a > f=k*d-b > a,b,c,d=c,d,e,f > puts "#{a}/#{b}" > end > > Now that's really low! Low as in the ethical sense, not the byte count. Way lower in the ethical sense and pretty nifty in the byte count is... puts "0/1 1/7 1/6 1/5 1/4 2/7 1/3 2/5 3/7 1/2 4/7 3/5 2/3 5/7 3/4 4/5 5/6 6/7 1/1 " John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand