$N=<>; for$a(1..$N-2){ for$b($a..$N-1){ $c=$N-($a+$b); last if$c<$b; print"$a $b $c\n" } }