Three regular polygons, all with unit sides, share a common vertex and are all coplanar. Each polygon has a different number of sides, and each polygon shares a side with the other two; there are no gaps or overlaps. Find the number of sides for each polygon. There are multiple answers.
(In reply to
re(3): solution- Missed Solution! by SilverKnight)
Actually it was a bug in the program. The portion of the program which checks for any one or two angles above 120 degrees (number of sides > 6) checked the number of degrees in the angle to be integral, instead of properly checking the number of sides in the polygon to be integral.
The wrong code:
FOR j = 7 TO i - 1
t = j * 180 - 360
a1 = t / j
a2 = remain - a1
IF a2 < 180 THEN
IF ABS(a2 - INT(a2 + .5)) < 1E-12 THEN
GOSUB reportToHex
PRINT "1"; STR$(j); "-gon; ";
PRINT "1"; STR$(360 / (180 - a2)); "-gon; "
END IF
END IF
NEXT
The right code:
FOR j = 7 TO i - 1
t = j * 180 - 360
a1 = t / j
a2 = remain - a1
s2 = 360 / (180 - a2)
IF a2 < 180 THEN
IF ABS(s2 - INT(s2 + .5)) < 1E-12 THEN
GOSUB reportToHex
PRINT "1"; STR$(j); "-gon; ";
PRINT "1"; STR$(INT(s2 + .5)); "-gon; "
END IF
END IF
NEXT
The correct output:
3 hexagons;
2 pentagons; 1 10-gon;
1 square; 2 8-gons;
1 square; 1 hexagon; 1 12-gon;
1 square; 1 pentagon; 1 20-gon;
4 squares;
1 triangle; 2 12-gons;
1 triangle; 1 7-gon; 1 42-gon;
1 triangle; 1 8-gon; 1 24-gon;
1 triangle; 1 9-gon; 1 18-gon;
1 triangle; 1 10-gon; 1 15-gon;
1 triangle; 2 squares; 1 hexagon;
2 triangles; 2 hexagons;
2 triangles; 1 square; 1 12-gon;
3 triangles; 2 squares;
4 triangles; 1 hexagon;
6 triangles;
|
Posted by Charlie
on 2004-07-13 15:37:32 |