# 2 To The 2 To The 2 To The 2 To The Ad Infinitum

**Number Theory**Level 5

\[\large 2,2^2,2^{2^2},2^{2^{2^2}},\ldots\] The sequence above can be recursively defined by \[a_1=2, a_{k+1}=2^{a_{k}}\]

Given a positive integer \(n\), a new sequence is created by dividing each term \(\{a_k\}\) by \(n\) and writing down the remainder of the division. We denote this new sequence by \(\{b_{k}\}\).

For a given \(n\), it is known that the terms of \(\{b_{k}\}\) eventually become constant. Let \(f(n)\) denote the index at which the constant values begin, i.e. \(f(n)\) is the smallest number \(i\) for which \( b_{i-1} \neq b_i = b_{i+1} = b_{i+2} = \cdots \).

Find \(f(2016)+f(2015)\).