Solution:
Let f(n) denote the number of n-tuples (a1,…,an) such that 0≤a1,…,an≤7 and 5∣2a1+…+2an. To compute f(n+1) from f(n), we note that given any n-tuple (a1,…,an) such that 0≤a1,…,an≤7 and 5∤2a1+…+2an, there are exactly two possible values for an+1 such that 0≤an+1≤7 and 5∣2a1+…+2an+1, because 2n≡1,2,4,3,1,2,4,3(mod5) for n=0,1,2,3,4,5,6,7 respectively.
Also, given any valid (n+1)-tuple (a1,…,an+1), we can remove an+1 to get an n-tuple (a1,…,an) such that 0≤a1,…,an≤7 and 5∤2a1+…+2an, so these are in bijection. There are a total of 8n n-tuples, f(n) of which satisfy 5∣2a1+…+2an, so there are 8n−f(n) for which 5∤2a1+…+2an. Therefore, f(n+1)=2(8n−f(n)).
We now have f(1)=0, f(2)=2(8−0)=16, f(3)=2(64−16)=96, f(4)=2(512−96)=832, f(5)=2(4096−832)=6528.
Answer: 6528