Solution:
We have a1=1+2⋅12,a2=32+2⋅12,a3=32+2⋅42,a4=112+2⋅42, etc. We will prove by induction on n that
a2n−1=an−12+2(2an−an−1)2 and a2n=an2+2(2an−an−1)2,
where a0=1. Assume that the claim holds for n. Then
a2n+1a2n+2=4a2n−a2n−1=4an2+8(2an−an−1)2−an−12−2(2an−an−1)2=211an2−3anan−1+21an−12=211an2−3an(4an−an+1)+21(4an−an+1)2=23an2−anan+1+21an+12=an2+2(2an+1−an)2=4a2n+1−a2n=4an2+8(2an+1−an)2−an2−2(2an−an−1)2=3an2+8(2an+1−an)2−2(2an+1−3an)2=23an+12−anan+1+21an2=an+12+2(2an+1−an)2,
which completes the proof.
Second solution. It is known that an odd natural number m>1 can be represented in the form a2+2b2 for some coprime a,b∈N if and only if all prime divisors of m are of the form 8k+1 or 8k+3,k∈N0. It is easy to see that all terms of the sequence (an) are odd; it remains to show that if a prime number p divides an, then p=8k+1 or p=8k+3 for some k∈N0.
One shows by induction on n that anan+2=an+12+2. Indeed, this holds for n≤2, and for n>2, assuming it holds for n−2, we have
anan+12+2=an(4an−an−1)2+2=16an−8an−1+anan−12+2=16an−8an−1+an−2=4an+1−an=an+2
From this it follows that −2 is a quadratic residue modulo every prime divisor p of the number an, so p≡1 or p≡3(mod8).