pattern
sub <sum_name>($n) { my ($total,$k)=0,1; while $k<=$n { $total=$total+<term>; $k=<suc>; } return $total; }