For positive integral $k>1$, we let $p(k)$ be its smallest prime divisor. Given an integer $a_1>2$, we define an infinite sequence $a_n$ by $a_{n+1}=a_n^n-1$ for each $n\geq 1$. For which values of $a_1$ is the sequence $p(a_n)$ bounded?
1. **Define the sequence and smallest prime divisor function:**
   Given an integer \( a_1 > 2 \), we define an infinite sequence \( a_n \) by \( a_{n+1} = a_n^n - 1 \) for each \( n \geq 1 \). Let \( p(k) \) be the smallest prime divisor of \( k \).

2. **Sequence properties:**
   Note that the sequence \( a_n \) alternates between odd and even values. This is because:
   - If \( a_n \) is odd, then \( a_n^n \) is odd, and thus \( a_{n+1} = a_n^n - 1 \) is even.
   - If \( a_n \) is even, then \( a_n^n \) is even, and thus \( a_{n+1} = a_n^n - 1 \) is odd.

3. **Claim: \( a_1 \) must be odd for \( p(a_n) \) to be bounded.**
   - Let \( \mathcal{S} = \{q_1, q_2, \dots, q_t\} \) be the set of values that \( p(a_n) \) takes.
   - Let \( p \) be any prime larger than all \( q_i \).
   - Let \( q = p(a_{p+1}) \). Note \( q \mid a_{p+1} = a_p^p - 1 \).

4. **Order of \( a_p \) modulo \( q \):**
   - If \( \text{ord}_q(a_p) = p \), then \( p \mid q-1 \), which is impossible since \( p \) is larger than any \( q_i \).
   - Hence, \( \text{ord}_q(a_p) = 1 \), implying \( q \mid a_p - 1 \).

5. **Contradiction with Dirichlet's theorem:**
   - By Dirichlet's theorem, consider a prime \( p \) such that \( p \equiv 1 \pmod{\prod_{i=1}^{t}(q_i - 1)} \).
   - This forces \( q_i - 1 \mid p - 1 \), implying \( a_{p-1}^{p-1} \equiv 0 \text{ or } 1 \pmod{q_i} \) for all \( q_i \in \mathcal{S} \).
   - However, for some \( q \in \mathcal{S} \), we have \( 2 \equiv a_{p-1}^{p-1} \), forcing \( q = 2 \).

6. **Conclusion:**
   - This implies \( 2 \mid a_{p-1} \), hence \( 2 \nmid a_1 \).
   - Therefore, \( a_1 \) must be odd.

7. **Verification for odd \( a_1 \):**
   - If \( a_1 \) is odd, then \( 2 \mid a_{2k} \) for all positive integers \( k \), so \( p(a_{2k}) = 2 \).
   - For \( a_4 = ((a_1 - 1)^2 - 1)^3 - 1 \equiv (a_1 - 1)^2 - 1 - 1 \not\equiv 0 \pmod{3} \), hence \( a_5 = a_4^4 - 1 \equiv 0 \pmod{3} \).
   - If \( 3 \mid a_n \) where \( n \) is odd, then \( a_{n+2} = (a_n^n - 1)^{n+1} - 1 \equiv (-1)^{n+1} - 1 \equiv 0 \pmod{3} \), so \( p(a_{2k+1}) = 3 \) for all \( k \geq 2 \).

Hence, we are done! \(\blacksquare\)

The final answer is \( \boxed{ \text{all odd values of } a_1 } \).