Problem

Source: Baltic Way 2011

Tags: modular arithmetic, least common multiple, algebra proposed, algebra



A sequence $a_1,a_2,a_3,\ldots $ of non-negative integers is such that $a_{n+1}$ is the last digit of $a_n^n+a_{n-1}$ for all $n>2$. Is it always true that for some $n_0$ the sequence $a_{n_0},a_{n_0+1},a_{n_0+2},\ldots$ is periodic?