#!/usr/bin/perl use strict; my $max = shift or die "Usage: $0 <max len>\n"; for my $t ( 2..sqrt$max ){ for my $s ( 1..$t-1 ){ my $c=$t*$t+$s*$s; next unless $c <= $max; my $a = $t*$t-$s*$s; my $b = 2*$s*$t; print "$a $b $c is a winner\n"; } }
In reply to Re: Re: Re: Pythagorean theorem
by I0
in thread Pythagorean's theorem
by fuzzyping
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |