Relation between Hecke operators and coefficient of L-functions This question has its seed in this one by Gory, which found an enlightening answer but one of the comments kept me wondering. I am beginning to discover Hecke operators, and there appears to be an ubiquitous relation between Hecke eigenvalues and coefficients of L-functions that I do not get at all. I will try to state everything in details.
Hecke operators. Let us fix a place $p$ and consider an unramified local component $\pi_p$ of an automorphic representation of $GL_2$ over $F$. Let $K_p$ denote $GL_2(\mathcal{O}_p)$. We define the Hecke operator $T_{p^i}$ as the convolution action of the characteristic function of
$$\bigcup_{\substack{a+b = i \\ a \geqslant b}} 
K_p
\left(
\begin{array}{cc}
p^a & \\
 & p^b
\end{array}
\right)
K_p$$
L-functions. The automorphic representation $\pi$ also has an attached $L$-function (built on the Satake parameters at unramified places and a specific completion defining the remaining factors) which can be written as (and this defines the $\lambda_\pi(n)$)
$$L(s, \pi) = \sum_{n \geqslant 1} \lambda_\pi(n) n^{-s}$$
Coefficients as eigenvalues. With all those definitions in hand, if $\phi$ is a function in the (one-dimensional) subspace of $K_p$-invariant vectors of $\pi_p$, do we have that
$$T_{p^i} \star \phi = p^{1/2} \lambda_\pi(p^i) \phi \quad ?$$
Questions. More precisely, I would like to ask both following (maybe elementary) questions:


*

*I know it for $i=1$ (for instance Gelbart), however does it remain for $i \geqslant 2$, and do you have a proof of that? 

*in the case where $\pi_p$ is ramified, those convolutions always give zero because there is no $K_p$ invariant vector in $\pi_p$ but the convolution creates such invariant vectors. In order to get the coefficient $\lambda_\pi(p^i)$ is this case, can I do exactly the same construction replacing $K_p$ by $K_1(p^f)$ where $f$ is the (additive) arithmetic conductor of $\pi_p$? (in that case the vector space of vectors fixed by it is one-dimensional)


I would appreciate any details or good reference for this matters, thanks in advance!
 A: A normalized version of your guess is right.  First note that the $T_{p^n}$'s satisfy the relation
$$ T_{p^{n+1}} = T_p T_{p^n} - p T_{p^{n-1}} $$
(e.g., Bump Prop 4.6.4).  This gives you a recursion relation among Hecke eigenvalues of $\phi$.  E.g., $T_{p^2} = T_p T_p - p T_1$ says if the eigenvalue for $T_p$ is $p^{1/2} a_p$, then the eigenvalue for $T_{p^2}$ is $p(a_p^2 - 1)$.
Now you want to compare with coefficients of the Dirichlet series.  Say the Satake parameters of $\pi$ are $\alpha=\alpha_p$ and $\alpha^{-1}$, so $a_p = \alpha + \alpha^{-1}$ (e.g., Bump Prop 4.6.6--here I'm assuming trivial central character for simplicity).  By the Euler product, you only need to look at the coefficients of the Dirichlet series for the factor at $p$, which is defined to be
$$ L_p(s,\pi) = \frac 1{1-\alpha p^{-s}} \frac 1{1-\alpha^{-1} p^{-s}}
= (\sum \alpha^i p^{-is} )( \sum \alpha^{-j} p^{-js} ) $$
Here the coefficient of $p^{ns}$ is 
$$ c_n := \lambda_\pi(p^n) = \sum_{i+j=n} \frac{\alpha^i}{\alpha^j}. $$
Now it is not hard to see the $c_n$'s satisfy the relation
$$ c_{n+1} = c_1 c_n - c_{n-1}. $$
For instance, for $n=2$, we have $c_2 = c_1 c_1 - c_0 = a_p^2 - 1$.
Comparing with the Hecke recurrence, one gets
$$ a_{p^n} = p^{\frac n2} c_n = p^{\frac n2} \lambda_\pi(p^n), $$
where $a_{p^n}$ is the eigenvalue of $T_{p^n}$.
For ramified representations, yes you can define Hecke operators using appropriate congruence subgroups $K_0(p^n)$ or $K_1(p^n)$, but you should do this a little differently if you want to get coefficients of Dirichlet series of newforms as Hecke eigenvalues.  That is, you shouldn't look at all double cosets in $GL_2(\mathbb Z_p$). See e.g. the book of Knightly and Li.
