The sides and height of a triangle are 4 consecutive integers.
Evaluate the triangle's area.
DEFDBL A-Z
a = 2: b = 3: c = 4: h = 1
DO
cosA = (b * b + c * c - a * a) / (2 * b * c)
sinA = SQR(1 - cosA * cosA)
hb = c * sinA: hc = b * sinA
cosB = (a * a + c * c - b * b) / (2 * a * c)
sinB = SQR(1 - cosB * cosB)
ha = c * sinB
d1 = ABS(1 - h / ha)
d2 = ABS(1 - h / hb)
d3 = ABS(1 - h / hc)
IF d1 < 1E-11 THEN
PRINT a; b; c, ha; "to a": ct = ct + 1
END IF
IF d2 < 1E-11 THEN
PRINT a; b; c, hb; "to b": ct = ct + 1
END IF
IF d3 < 1E-11 THEN
PRINT a; b; c, hc; "to c": ct = ct + 1
END IF
h = a: a = b: b = c: c = c + 1
LOOP UNTIL ct > 35
assumes the height is the lowest of the three integers and finds
13 14 15 12 to b
That is, the height is 12 and is to base b, the side with length 14.
The program was allowed to continue until, when it was stopped, the height equalled 35,115,854, and no other solutions were found.
DEFDBL A-Z
a = 2: b = 4: c = 5: h = 3
DO
cosA = (b * b + c * c - a * a) / (2 * b * c)
sinA = SQR(1 - cosA * cosA)
hb = c * sinA: hc = b * sinA
cosB = (a * a + c * c - b * b) / (2 * a * c)
sinB = SQR(1 - cosB * cosB)
ha = c * sinB
d1 = ABS(1 - h / ha)
d2 = ABS(1 - h / hb)
d3 = ABS(1 - h / hc)
IF d1 < 1E-11 THEN
PRINT a; b; c, ha: ct = ct + 1
END IF
IF d2 < 1E-11 THEN
PRINT a; b; c, hb: ct = ct + 1
END IF
IF d3 < 1E-11 THEN
PRINT a; b; c, hc: ct = ct + 1
END IF
a = h: h = b: b = c: c = c + 1
LOOP UNTIL ct > 35
This second version assumes the height is the second integer in order and it finds no solutions by the time h has reached 32,521,965.
Since two of the sides must exceed any given height of the triangle, no further versions are needed-- the height must be the first or second integer in the sequence.
So the only solution seems to be a height of 12 to the length-14 side of a 13-14-15 triangle. The area is 12*14/2 = 84.
The height divides the triangle into a 5-12-13 right triangle and a 9-12-15 right triangle.
|
Posted by Charlie
on 2010-02-15 14:20:20 |