Solution to #9. Used Euclid's formula for generating the triangles.