 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Minimum area of a triangle (Posted on 2008-07-30) Find the minimum area of a triangle whose sides and altitudes are six different integers.

 See The Solution Submitted by pcbouhid Rating: 2.0000 (2 votes) Comments: ( Back to comment list | You must be logged in to post comments.) re: Computer Solution | Comment 4 of 10 | (In reply to Computer Solution by Bractals)

A Basic program that finds the same result as Bractals' (and multiples thereof):

DECLARE FUNCTION acos# (x#)
DEFDBL A-Z
DIM SHARED pi

pi = ATN(1) * 4

FOR t = 3 TO 3000
FOR s1 = 1 TO t / 3
FOR s2 = s1 + 1 TO INT((t - s1) / 2)
s3 = t - s1 - s2
IF s1 > s3 - s2 THEN
a1 = acos((s2 * s2 + s3 * s3 - s1 * s1) / (2 * s2 * s3))
a2 = acos((s1 * s1 + s3 * s3 - s2 * s2) / (2 * s1 * s3))
a3 = acos((s2 * s2 + s1 * s1 - s3 * s3) / (2 * s2 * s1))
alt1 = s2 * SIN(a1)
alt2 = s3 * SIN(a2)
alt3 = s1 * SIN(a3)
IF ABS(alt1 - INT(alt1 + .5)) < .0000001# THEN
IF ABS(alt2 - INT(alt2 + .5)) < .0000001# THEN
IF ABS(alt3 - INT(alt3 + .5)) < .0000001# THEN
alt1 = INT(alt1 + .5)
alt2 = INT(alt2 + .5)
alt3 = INT(alt3 + .5)
n(1) = s1: n(2) = s2: n(3) = s3
n(4) = alt1: n(5) = alt2: n(6) = alt3
good = 1
FOR i = 1 TO 5
FOR j = i + 1 TO 6
IF n(i) = n(j) THEN good = 0: EXIT FOR
NEXT
IF good = 0 THEN EXIT FOR
NEXT
IF good THEN PRINT s1; s2; s3, alt1; alt2; alt3
END IF
END IF
END IF
END IF
NEXT s2
NEXT s1
NEXT

FUNCTION acos (x)
IF x = 0 THEN
acos = pi / 2
ELSE
a = ATN(SQR(1 - x * x) / x)
IF a < 0 THEN a = a + pi
acos = a
END IF
REM
END FUNCTION

 Posted by Charlie on 2008-07-30 18:51:00 Please log in:

 Search: Search body:
Forums (0)