From: Harry Ohlsen Date: 2003-07-01T20:56:55+09:00 Subject: Re: Terribly OT ... ts wrote: > Euh, this ??? > > > svg% cat b.rb > #!/usr/bin/ruby > def lcr(a, b, v) > r = a % b > if r == 0 > [] > else > q = a / b > x = [v[0] - q * v[2], v[1] - q * v[3]] > [x] + lcr(b, r, [v[2], v[3], *x]) > end > end > > def lc(a, b) > if b == 0 > [[1, 0]] > else > lcr(a, b, [1, 0, 0, 1]) > end + [[a, b]] > end > > p lc(93512222, 6812345) > svg% > > svg% b.rb > [[1, -13], [-1, 14], [3, -41], [-4, 55], [7, -96], [-11, 151], [227, -3116], [-919, 12615], [42501, -583406], [-43420, 596021], [1345101, -18464036], [-2733622, 37524093], [93512222, 6812345]] > svg% I'm not sure about all those negative numbers, but a heck of a lot of the values look right. So, I think your code is definitely a good starting point for me. It'll save me going down into the garage tonight ... it's 9:50pm here in Sydney ... to try and find my notes, anyway :-). Thanks! -- ------------------------------------- I have always imagined that Paradise will be a kind of library. - Jorge Luis Borges.