Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -33,10 +33,12 @@ BEGIN
FOR c TO 200 DO
FOR b TO c DO
FOR a TO b DO
IF gcd( gcd( a, b ), c ) = 1 THEN
t := try ht( a, b, c );
IF REF HERONIAN(t) ISNT REF HERONIAN(NIL) THEN
ht[ ht count +:= 1 ] := t
IF NOT ODD ( a + b + c ) THEN
IF gcd( gcd( a, b ), c ) = 1 THEN
t := try ht( a, b, c );
IF REF HERONIAN(t) ISNT REF HERONIAN(NIL) THEN
ht[ ht count +:= 1 ] := t
FI
FI
FI
OD
@ -46,7 +48,7 @@ BEGIN
# sort the table on ascending area, perimeter and max side length #
# note we constructed the triangles with c as the longest side #
BEGIN
INT lower := 1, upper := ht count;
INT lower := 1, upper := ht count;
WHILE upper := upper - 1;
BOOL swapped := FALSE;
FOR i FROM lower TO upper DO
@ -76,8 +78,8 @@ BEGIN
print( ( "Heronian triangles with area 210:", newline ) );
ht title;
FOR ht pos TO ht count DO
REF HERONIAN t := ht[ ht pos ];
IF area OF t = 210 THEN ht print( t ) FI
REF HERONIAN tr := ht[ ht pos ];
IF area OF tr = 210 THEN ht print( tr ) FI
OD
END
END

View file

@ -0,0 +1,65 @@
func gcd x y .
if y = 0
return x
.
return gcd y (x mod y)
.
global ta[] tb[] tc[] .
proc mktbl . .
for c = 1 to 200
for b = 1 to c
for a = 1 to b
s = (a + b + c) / 2
ar = sqrt (s * (s - a) * (s - b) * (s - c))
if ar > 0 and ar = floor ar
if gcd gcd b c a = 1
ta[] &= a
tb[] &= b
tc[] &= c
.
.
.
.
.
.
mktbl
#
proc get i . a b c per ar .
a = ta[i]
b = tb[i]
c = tc[i]
per = a + b + c
s = per / 2
ar = sqrt (s * (s - a) * (s - b) * (s - c))
.
func wgt i .
get i a b c per ar
return ar * 1000000 + per * 1000 + a
.
proc sort . .
for i = 1 to len ta[] - 1
for j = i + 1 to len ta[]
if wgt j < wgt i
swap ta[j] ta[i]
swap tb[j] tb[i]
swap tc[j] tc[i]
.
.
.
.
sort
#
print "Number of triangles: " & len ta[]
print ""
numfmt 2 2
for i = 1 to 10
get i a b c per ar
print "(" & a & " " & b & " " & c & ") Perim: " & per & " Area: " & ar
.
print ""
for i = 1 to len ta[]
get i a b c per ar
if ar = 210
print "(" & a & " " & b & " " & c & ") Perim: " & per & " Area: " & ar
.
.