4. In how many different ways can the faces of a cube be painted using six given colors (each face must be painted entirely with one color), if only those colorings are considered different that cannot be made to coincide by rotating the cube?
4. Suppose the faces of a cube are painted green, blue, red, yellow, white, and black. Let's place the cube so that the green face is at the bottom. In this case, the top face can be painted one of the five remaining colors. It is clear that no two colorings, in which the top (i.e., opposite the green) face is painted different colors, can be aligned with each other by rotation. Now let's determine the number of colorings in which the top face is painted a certain color (say, blue); the total number of colorings is five times this number (since the top face can be painted any of the 5 remaining colors).

Choose one of the four colors remaining after removing green and blue (say, red) and place our cube so that the red face is the back face; this can always be achieved by rotating the cube around the vertical axis. We have 3 colors left - yellow, white, and black, with which we need to paint the 3 faces (the front and two side faces). Clearly, none of the resulting colorings can be aligned with each other by rotation - with any rotation, either the bottom face will no longer be green, or the back face will no longer be red. The three faces can be painted with the three colors in six different ways (the front face can be painted any of the three colors, and for each of these colorings, we can choose the color of the left face in two ways).

Therefore, the total number of colorings that cannot be aligned by rotating the cube is $5 \cdot 6=30$.