From: Robert Dober Date: 2007-01-26T01:46:54+09:00 Subject: Re: Codegolf: Pascal's Triangle ------=_Part_29095_9357078.1169743612785 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 1/25/07, Drew Olson wrote: > > Hi all! > > I've been quite addicted to www.codegolf.com for a while and I'm trying > to skim down my Pascal's Triangle program. The challenge description is > here: http://codegolf.com/pascals-triangle. I'm currently at 84 bytes, > but some awesome ruby coders have done it in 43 bytes! Take a look at > the code and let me know if there's anything glaringly obvious I could > do the reduce character count. New lines have been added for > readability, there are no new lines in the true code. > > def f(n) > n<1?1:n*f(n-1) > end; > > 34.times{|i| > puts((0..i).map{|j|f(i)/(f(j)*f(i-j))}*' ') > } > > -- > Posted via http://www.ruby-forum.com/. > > There must be a solution with 42 characters, it's a well known law ;) -- "The best way to predict the future is to invent it." - Alan Kay ------=_Part_29095_9357078.1169743612785--