Call an $n$-tuple $(a_1, . . . , a_n)$ occasionally periodic if there exist a nonnegative integer $i$ and a positive integer $p$ satisfying $i + 2p \le n$ and $a_{i+j} = a_{i+p+j}$ for every $j = 1, 2, . . . , p$. Let $k$ be a positive integer. Find the least positive integer $n$ for which there exists an $n$-tuple $(a_1, . . . , a_n)$ with elements from set $\{1, 2, . . . , k\}$, which is not occasionally periodic but whose arbitrary extension $(a_1, . . . , a_n, a_{n+1})$ is occasionally periodic for any $a_{n+1} \in \{1, 2, . . . , k\}$.