What digit stands before the decimal point in the number $(3+\sqrt{7})^{2004}$?
Solution. Let's write the sum $(3+\sqrt{7})^{2004}+(3-\sqrt{7})^{2004}$ using the binomial theorem:

$$
\begin{aligned}
& (3+\sqrt{7})^{2004}+(3-\sqrt{7})^{2004}= \\
& =\binom{2004}{0} \cdot 3^{2004}+\binom{2004}{1} \cdot 3^{2003} \cdot \sqrt{7}+\binom{2004}{2} \cdot 3^{2002} \cdot \sqrt{7}^{2}+\ldots+ \\
& +\binom{2004}{0} \cdot 3^{2004}-\binom{2004}{1} \cdot 3^{2003} \cdot \sqrt{7}+\binom{2004}{2} \cdot 3^{2002} \cdot \sqrt{7}^{2}+\ldots
\end{aligned}
$$

It is clear that the terms where $\sqrt{7}$ appears with an odd exponent will cancel out, as they appear with opposite signs in the two expressions. The terms with even exponents are integers.

$(3+\sqrt{7})^{2004}+(3-\sqrt{7})^{2004}$ is therefore an integer.

$3-\sqrt{7}<1$, so $(3-\sqrt{7})^{2004}<1$, which means the digit before the decimal point in $(3+\sqrt{7})^{2004}$ is one less than the digit in the units place of $(3+\sqrt{7})^{2004}+(3-\sqrt{7})^{2004}$. (If the integer ends in 0, then of course it is 9.)

$$
\begin{aligned}
& (3+\sqrt{7})^{2004}+(3-\sqrt{7})^{2004}=\left((3+\sqrt{7})^{3}\right)^{668}+\left((3-\sqrt{7})^{3}\right)^{668}= \\
& =(27+27 \cdot \sqrt{7}+9 \cdot 7+7 \sqrt{7})^{668}+(27-27 \cdot \sqrt{7}+9 \cdot 7-7 \sqrt{7})^{668}= \\
& =(90+34 \sqrt{7})^{668}+(90-34 \sqrt{7})^{668}
\end{aligned}
$$

As we have already seen, the terms containing $\sqrt{7}$ appear with opposite signs in the two sums, so they will cancel out, and the terms with even exponents will appear twice.

$$
\begin{aligned}
& (90+34 \sqrt{7})^{668}+(90-34 \sqrt{7})^{668}= \\
& =\sum_{n=0}^{668}\binom{668}{n} 90^{668-n} \cdot 34^{n} \cdot \sqrt{7}^{n}+\sum_{n=0}^{668}(-1)^{n} \cdot\binom{668}{n} 90^{668-n} \cdot 34^{n} \cdot \sqrt{7}^{n}= \\
& =\sum_{k=0}^{334} 2 \cdot\binom{668}{2 k} 90^{668-2 k} \cdot 34^{2 k} \cdot 7^{k}=2 \cdot \sum_{k=0}^{334}\binom{668}{2 k} 90^{668-2 k} \cdot 34^{2 k} \cdot 7^{k} .
\end{aligned}
$$

The terms in the sum, except for the case $k=334$, contain 90 as a real factor, so they end in 0. For $k=334$, the term to be added is

$$
2 \cdot\binom{668}{668} \cdot 90^{0} \cdot 34^{668} \cdot 7^{334}
$$

We are interested in the last digit of $2 \cdot 34^{668} \cdot 7^{334}$.

Every even power of 34 ends in 6 (odd powers end in 4). The powers of 7 end in $7,9,3,1$ respectively. Since 334 divided by 4 leaves a remainder of 2, the last digit of $7^{334}$ is 9. Therefore, the last digit of the last term is the last digit of $2 \cdot 6 \cdot 9$, which is 8.

The digit before the decimal point in $(3+\sqrt{7})^{2004}$ is 7.