4. There are 294 different cards with numbers $7, 11, 7^{2}, 11^{2}, \ldots, 7^{147}, 11^{147}$ (each card has exactly one number, and each number appears exactly once). In how many ways can 2 cards be chosen so that the product of the numbers on the chosen cards is a square of an integer?
Answer: 15987.

Solution. To obtain the square of a natural number, it is necessary and sufficient that each factor enters the prime factorization of the number in an even power.

Suppose two cards with powers of seven are chosen. We have 73 even exponents $(2,4,6, \ldots, 146)$ and 74 odd exponents $(1,3,5, \ldots, 147)$. We need the sum of the exponents to be even. For the sum of two natural numbers to be even, we can either choose two even numbers $\left(C_{73}^{2}=\frac{73 \cdot 72}{2}=2628\right.$ ways $)$, or two odd numbers $\left(C_{74}^{2}=\frac{74 \cdot 73}{2}=2701\right.$ ways $)$. We get $2628+$ $2701=5329$ ways.

The number of ways when the powers of 11 are written on both chosen cards is exactly the same, i.e., 5329.

If one card with a power of seven and one card with a power of 11 are taken, then both exponents must be even - we get $73 \cdot 73=5329$ ways.

In total: $5329 \cdot 3=15987$ ways.