27. N8 (IRN) Let $p$ be a prime number and let $A$ be a set of positive integers that satisfies the following conditions: (i) the set of prime divisors of the elements in $A$ consists of $p-1$ elements; (ii) for any nonempty subset of $A$, the product of its elements is not a perfect $p$ th power. What is the largest possible number of elements in $A$?
27. Let $p_{1}, p_{2}, \ldots, p_{r}$ be distinct primes, where $r=p-1$. Consider the sets $B_{i}=\left\{p_{i}, p_{i}^{p+1}, \ldots, p_{i}^{(r-1) p+1}\right\}$ and $B=\bigcup_{i=1}^{r} B_{i}$. Then $B$ has $(p-1)^{2}$ elements and satisfies (i) and (ii). Now suppose that $|A| \geq r^{2}+1$ and that $A$ satisfies (i) and (ii), and let $\left\{t_{1}, \ldots, t_{r^{2}+1}\right\}$ be distinct elements of $A$, where $t_{j}=p_{1}^{\alpha_{j_{1}}} \cdot p_{2}^{\alpha_{j_{2}}} \cdots p_{r}^{\alpha_{j_{r}}}$. We shall show that the product of some elements of $A$ is a perfect $p$ th power, i.e., that there exist $\tau_{j} \in\{0,1\}\left(1 \leq j \leq r^{2}+1\right)$, not all equal to 0, such that $T=t_{1}^{\tau_{1}} \cdot t_{2}^{\tau_{2}} \cdots t_{r^{2}+1}^{\tau_{r^{2}+1}}$ is a $p$ th power. This is equivalent to the condition that 
$$ \sum_{j=1}^{r^{2}+1} \alpha_{i j} \tau_{j} \equiv 0(\bmod p) $$
holds for all $i=1, \ldots, r$. By Fermat's theorem it is sufficient to find integers $x_{1}, \ldots, x_{r^{2}+1}$, not all zero, such that the relation 
$$ \sum_{j=1}^{r^{2}+1} \alpha_{i j} x_{j}^{r} \equiv 0(\bmod p) $$
is satisfied for all $i \in\{1, \ldots, r\}$. Set $F_{i}=\sum_{j=1}^{r^{2}+1} \alpha_{i j} x_{j}^{r}$. We want to find $x_{1}, \ldots, x_{r}$ such that $F_{1} \equiv F_{2} \equiv \cdots \equiv F_{r} \equiv 0(\bmod p)$, which is by Fermat's theorem equivalent to 
$$ F\left(x_{1}, \ldots, x_{r}\right)=F_{1}^{r}+F_{2}^{r}+\cdots+F_{r}^{r} \equiv 0(\bmod p) . $$
Of course, one solution of (1) is $(0, \ldots, 0)$: we are not satisfied with it because it generates the empty subset of $A$, but it tells us that (1) has at least one solution. We shall prove that the number of solutions of (1) is divisible by $p$, which will imply the existence of a nontrivial solution and thus complete the proof. To do this, consider the sum $\sum F\left(x_{1}, \ldots, x_{r^{2}+1}\right)^{r}$ taken over all vectors $\left(x_{1}, \ldots, x_{r^{2}+1}\right)$ in the vector space $\mathbb{Z}_{p}^{r^{2}+1}$. Our statement is equivalent to 
$$ \sum F\left(x_{1}, \ldots, x_{r^{2}+1}\right)^{r} \equiv 0(\bmod p) $$
Since the degree of $F^{r}$ is $r^{2}$, in each monomial in $F^{r}$ at least one of the variables is missing. Consider any of these monomials, say $b x_{i_{1}}^{a_{1}} x_{i_{2}}^{a_{2}} \cdots x_{i_{k}}^{a_{k}}$. Then the sum $\sum b x_{i_{1}}^{a_{1}} x_{i_{2}}^{a_{2}} \cdots x_{i_{k}}^{a_{k}}$, taken over the set of all vectors $\left(x_{1}, \ldots, x_{r^{2}+1}\right) \in \mathbb{Z}_{p}^{r^{2}+1}$, is equal to 
$$ p^{r^{2}+1-u} \cdot \sum_{\left(x_{i_{1}}, \ldots, x_{i_{k}}\right) \in \mathbb{Z}_{p}^{k}} b x_{i_{1}}^{a_{1}} x_{i_{2}}^{a_{2}} \cdots x_{i_{k}}^{a_{k}}, $$
which is divisible by $p$, so that (2) is proved. Thus the answer is $(p-1)^{2}$.