in reply to generating pyramid number sequence
I'm suppose i'm late :'( ...
Japhy solution solves the problem in a very smart way, i like it too much.
But I have written another (before read any solution ^_^), i put it here for the collection :-)
$max = 7; for ($i=1; $i<$max; $i++) { @tuple = (0,$i); print ++$tuple[0],',',++$tuple[1],' ' while ($tuple[1] < $max) +; print "\n" }
for ($M=7, $i=1; @_ = (0,$i), $i<$M; $i++) { print ++$_[0],',',++$_[1],($_[1]==$M?"\n":" ") while ($_[1] +< $M) }
turo
|
|---|