In the sequence ... starting from the 5, each digit is the last digit of the sum of the four preceding digits. Prove that the digit group 1978 appears again in the sequence, but the digit group 1526 never appears!
Problem 987
Official solution
Starting from the number 1978, the next digit is given by the last digit of the sum of 3 odd (i.e., 1, 9, 7) and 1 even (8) numbers. Therefore, this will be an odd number. In the next three steps, the same situation occurs. In the 4th step, 4 odd numbers are added together. In this case, the sum, and therefore the last digit, will be even. Then the whole process starts over from the beginning. Thus, in the sequence, 1 even number digit always follows 4 odd number digits. The group of digits 1526, therefore, cannot occur in the sequence because it contains 2 even digits next to each other.
We will show that the group of digits 1978 reappears in the sequence. Indeed, there are only a finite number of 4-digit groups, while the sequence is infinitely long. Due to the clear rule of formation, from a certain point onwards, the elements of the sequence repeat periodically. But in this period, the group of digits 1978 must be present, because the sequence can also be uniquely determined backwards, i.e., from right to left.