8.3. Can the numbers $1,2,3, \ldots, n$ be rearranged so that adjacent numbers in the sequence differ by either 3 or 5, if a) $n=25 ;$ b) $n=1000$.
Answer: a) possible; b) possible. Solution. The numbers can be rearranged as follows:

a) $\mathbf{1}, 4,7,2,5,8,3,6,9,12,15,10,13,16,11,14,17,20,23,18,21,24,19,22, \mathbf{2 5}$. b) The solution to part a) shows how to sequentially rearrange octets of numbers of the form $8 k+1,8 k+2, \ldots, 8 k+8$, specifically: $8 k+1,8 k+4,8 k+7,8 k+2,8 k+5,8 k+8,8 k+3,8 k+6,8(k+1)+1$ and transition to the next octet. Thus, the numbers $1,2, \ldots, n$ can be rearranged when $n$ is of the form $4 m$ or $4 m+1$. Since 1000 is divisible by 8, we obtain the result for part b).