The key is that each side of a figure must be an integer number of matches. And, of course, with "triangle", "square", "pentagon", "hexagon", "octagon", there are 10 pairs. To make "triangle and square" from n matches we must have 3i+ 4j= n, for some integers i and j. To make "triangle and pentagon" we must have 3u+ 5v= n for integers u and v. To make "triangle and hexagon" we must have 3p+ 6q= n, etc.