The solution, if each side of the polygon were made of three colored toothpicks in simply to substitute n^3 for n where n is the number of colors where each side is composed of a single toothpick.
Therefore,...
... for triangles, the equation is transformed from
(n^3 + 2n)/3 to
(n^9 + 2n^3)/3.
... for squares, the equation is transformed from
(n^4 + n^3 + 2*n)/4 to
(n^12 + n^9 + 2n^3)/4.
[One can reference
The OnLine Encylopedia of Integer Sequences to find the equations for the "number of ways to color vertices of a triangle using <= n colors, allowing only rotations" (Sloan A006527) and the "number of ways to color vertices of a square using <= n colors, allowing only rotations" (Sloan A006528).]

Posted by Dej Mar
on 20080305 10:53:52 