<s>[INST] Let $( \sqrt{2} + 1)^{1000} = a + b \sqrt{2}$, where a and b are integers. Find the greatest common factor of b and 81. Let $( \sqrt{2} + 1)^{1000} = a + b \sqrt{2}$, where $a$ and $b$ are integers. Find the greatest common factor of $b$ and $81$.
How would one solve this question? I tried to use the binomial theorem but that approach did not work. How would one solve this problem if it were to appear on a Math Olympiad?  
I know the answer is one of:
(A) 1 (B) 3 (C) 9 (D) 27 (E) 81.
According to one of the Stack Exchange members, the answer is 3. It was found using Python.  
 [/INST] It is a bit annoying, but certainly feasible, to compute the answer by repeated squaring in $(\mathbb{Z}/81\mathbb{Z})[\sqrt{2}]$.
$$(1+\sqrt{2})^2 \equiv 3+2\sqrt{2}$$
$$(1+\sqrt{2})^4 \equiv 17+12\sqrt{2}$$
$$(1+\sqrt{2})^8 \equiv 10+3\sqrt{2}$$
$$(1+\sqrt{2})^{16} \equiv 37+60\sqrt{2}$$
$$(1+\sqrt{2})^{32} \equiv 64+66\sqrt{2}$$
$$(1+\sqrt{2})^{64} \equiv 10 + 24\sqrt{2}$$
$$(1+\sqrt{2})^{128} \equiv 37 + 75\sqrt{2}$$
$$(1+\sqrt{2})^{256} \equiv 64 + 42\sqrt{2}$$
$$(1+\sqrt{2})^{512} \equiv 10 + 30\sqrt{2}.$$
Now in binary, $1000 = 1111101000_2$, or in other words, $1000 = 512 + 256 + 128 + 64 + 32 + 8.$ Therefore for any $a$
$$a^{1000} = a^{8}a^{32}a^{64}a^{128}a^{256}a^{512},$$
and we can calculate this product for $a=(1+\sqrt{2})$ using the table above:
$$(1+\sqrt{2})^{40}\equiv 64+42\sqrt{2}$$
$$(1+\sqrt{2})^{104}\equiv 64+12\sqrt{2}$$
$$(1+\sqrt{2})^{232}\equiv 37+60\sqrt{2}$$
$$(1+\sqrt{2})^{488}\equiv 37+48\sqrt{2}$$
$$(1+\sqrt{2})^{1000}\equiv 10+51\sqrt{2}$$
and $(51,81)=3.$
</s>