Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2023/ia/paper-2/4f/b/solution

Let be the event that the block beginning at position , , is a spalindrome. Each has probability . If two starting positions differ by , the first half of the later block contains the middle digit of the earlier palindrome twice, contradicting distinctness. Thus the only possible overlap is .
That intersection consists of words , where has distinct digits, and hence has probability . This overlap structure of digit spalindromes makes inclusion--exclusion give

New to topics? Read the docs here!