Find all triplets $(x, y, z)$ of positive integers such that $x^{2}+y^{2}=3 \times 2016^{z}+77$
Let's look at the prime factors of $2016: 2016=4 \times 504=16 \times 126=2^{5} \times 63=2^{4} \times 7 \times 9$. Thus, it seems natural to look at the equation modulo a power of 2 (for example 8), modulo 9, or modulo 7 in the case where $z \geqslant 1$. Modulo 8 the equation becomes $x^{2}+y^{2} \equiv 5$. Unfortunately, 4 and 1 are squares. Modulo 9 the equation becomes $x^{2}+y^{2} \equiv 5$. Unfortunately, 4 and 1 are squares.

Let's then look modulo 7: if $z \geqslant 1$ the equation becomes $x^{2}+y^{2} \equiv 0(\bmod 7)$. The squares modulo 7 are $0,1,4,2$. Thus, we must have $x^{2} \equiv y^{2} \equiv 0(\bmod 7)$, so 7 divides $x$ and $y$. In particular, $7^{2}$ divides $x^{2}+y^{2}$. Thus, if $z \geqslant 2, 7^{2}$ divides $3 \times 2016^{z}$, so $7^{2}$ divides $77=7 \times 11$, a contradiction.

Thus, it remains to handle the cases where $z \leqslant 1$. If $z=1$, we have shown that 7 divides $x$ and $y$. Let $x=7k$ and $y=7l$ with $k$ and $l$ positive integers. Then we have $7^{2}(k^{2}+l^{2})=7 \times (3 \times 288 + 11) = 7 \times 875 = 7^{2} \times 125$, so $k^{2}+l^{2}=125$. By symmetry, we can assume $k \leqslant l$, so $2k^{2} \leqslant 125$ and thus $k^{2} \leqslant 62$ and $k \leqslant 7$. It remains to test the different possible values of $k$: for $k$ between 0 and 7, we get $l^{2}=125,124,121=11^{2}, 116,109,100=10^{2}, 89,76$. Only 121 and 100 are squares, so the only triplets solutions are $(14,77,1),(77,14,1),(35,70,1),(70,35,1)$. Conversely, we verify that these work because $14^{2}+77^{2}=49 \times (4+121)=49 \times 125 = 3 \times 2016 + 77$ and because $35^{2}+70^{2}=49 \times (25+100)=49 \times 125=3 \times 2016 + 77$.

It only remains to handle the case where $z=0$: we have $x^{2}+y^{2}=80$. Modulo 4, $x^{2}+y^{2} \equiv 0(\bmod 4)$, so since a square modulo 4 is 0 or 1, $x$ and $y$ are necessarily even. By setting $x=2k$ and $y=2l$ with $k$ and $l$ positive integers, we get $k^{2}+l^{2}=\frac{80}{4}=20$. Similarly, $k$ and $l$ are even, so we set $k=2a, l=2b$ with $a$ and $b$ positive integers, and we get $a^{2}+b^{2}=5$. In particular, we have $0 \leqslant a \leqslant 2$ and the same for $b$. By testing all possibilities, we get $(a, b)=(1,2)$ or $(2,1)$, so $(x, y, z)=(4,8,0)$ or $(8,4,0)$, which works because $8^{2}+4^{2}=64+16=3+77$.

Thus, the triplet solutions are $(4,8,0),(8,4,0),(14,77,1),(77,14,1),(35,70,1),(70,35,1)$.