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)) < 1E12 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)) < 1E12 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 10gon;
1 square; 2 8gons;
1 square; 1 hexagon; 1 12gon;
1 square; 1 pentagon; 1 20gon;
4 squares;
1 triangle; 2 12gons;
1 triangle; 1 7gon; 1 42gon;
1 triangle; 1 8gon; 1 24gon;
1 triangle; 1 9gon; 1 18gon;
1 triangle; 1 10gon; 1 15gon;
1 triangle; 2 squares; 1 hexagon;
2 triangles; 2 hexagons;
2 triangles; 1 square; 1 12gon;
3 triangles; 2 squares;
4 triangles; 1 hexagon;
6 triangles;

Posted by Charlie
on 20040713 15:37:32 