From: Phrogz Date: 2007-03-20T07:20:04+09:00 Subject: Re: Golfing the Farey Sequence On Mar 19, 4:12 pm, John Carter wrote: > On Sun, 18 Mar 2007, Phrogz wrote: > > Here's a cheap shot :-P > > > Here's starting code, based on the algorithm included in the Wikipedia > > article for the Farey Sequence:[1] > > - N = 7 > + N = 8 > > a,b,c,d=0,1,1,N > - puts "#{a}/#{b}" > while c + puts "#{a}/#{b}" > k = (N+b)/d > e = k*c-a > f=k*d-b > a,b,c,d=c,d,e,f > - puts "#{a}/#{b}" > end I don't think there are any cheap shots in golf...except those that change the output. You've left off the final "1/1" for the sequence this way.