[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] fun with numbers



> write a program as short as possible(i made one, less than 70
> characters) to print numbers derived from (x+y) ** n (n is 1
> to 14) in the following format:
> 
> 1
> 1 1
> 1 2 1

Mine's 52 characters:

    print"@_\n"while(@_=(1,map$_[$_-1]+$_[$_],1..@_))<15

Without the limit of n=14, it's only 47:

    print"@_\n"while@_=(1,map$_[$_-1]+$_[$_],1..@_)

It's called Pascal's triangle, by the way.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe