in reply to (golf) Triangle of numbers

Update 3: seeing japhys and blakes code, I reduce my code to 70
$n=1+length$a++*$a/2;map{map{printf"%${n}d",++$k}1..$_;print$/}1..$a-1

Replies are listed 'Best First'.
Re: Re: (golf) Triangle of numbers
by blakem (Monsignor) on Oct 26, 2001 at 11:32 UTC
    I can trim two chars from that.... to tie japhy at 68
    # 1 2 3 4 5 6 #2345678901234567890123456789012345678901234567890123456789012345678 $n=length$a++*$a/2;map{map{printf" %$n.d",++$k}1..$_;print$/}1..$a-1

    -Blake

      I can beat 2 characters.
      How about this (66 chars):
      $n=length$a++*$a/2;map{map{printf" %$n.d",++$k}2..$_;print$/}0..$a

      There are two "\n", I know, but writes exactly what I want... :-)
      Hopes