Skip to content

Instantly share code, notes, and snippets.

@mshock
Last active December 18, 2015 12:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mshock/5781936 to your computer and use it in GitHub Desktop.
golf - Pascal's Triangle (34 rows) - 61 chars
$z='1';
$r=$z;
for(0..32){
@d=split' ',$z;
unshift@d,0;
@n=();
while($#d!=-1){
push@n,($d[0]||0)+($d[1]||0);
shift@d
}
$z=join' ',@n;
$r.="\n$z"
}
print $r
print join"
",map{join(' ',@z=(1,map{$z[1]+shift@z}@z))}0..33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment