What are the $p$-adic representations of $\hat{\mathbb{Z}}$ ?

A continuous representation $\hat{\mathbb{Z}} \rightarrow GL_n(\mathbb{Q}_p)$ is determined by the image of $1$. But the image of $1$ does not always defines such a representation (consider for example the representation which sends $1$ on $p$ from $\mathbb{Z}$ to $GL_1(\mathbb{Q}_p)$). So my question is : what are the conditions on the image of $1$ ?

For example if $n=1$, then I know that $1$ must be sent on an element of $\mathbb{Z}_p^\times$, but I don't know if the converse is true.

-
I'm not entirely right either: instead of "stabilises a lattice" I should say it induces an isomorphism from a lattice to itself. – Kevin Buzzard Nov 4 '10 at 18:40
If the image of 1 lands in some conjugate of GL(n,Z_p) then some finite power will land in the kernel of the map from this group to GL(n,Z/pZ) and then you're fine because this is pro-p and so there's a map from Z_p in. So the condition I suggest is sufficient. – Kevin Buzzard Nov 4 '10 at 18:47
The condition I suggest is also necessary. Choose a random lattice in Q_p^n. Choose a continuous representation of Z-hat. Continuous image of compact is compact so the subgroup generated by the images of this lattice is a lattice and that's the one which is preserved by 1 and -1. Ok so I think we're done. – Kevin Buzzard Nov 4 '10 at 18:48
Sorry, forgot to add the condition that the constant term must be invertible. – Torsten Ekedahl Nov 4 '10 at 19:04
@Kevin: yes I think so! Just to recap: the continuous image of a compact set is compact so the image has to land in a compact subgroup of $GL_n(Q_p)$ which we know is conjugate to a subgroup of $GL_n(Z_p)$. Conversely if $M = card(GL_n(F_p))$ and $f(1)$ is (say) in $GL_n(Z_p)$ then for every $k$, the image of $p^{k-1}M Z$ is in $1+p^k M_n(Z_p)$ so the map from $Z$ extends by uniform continuity. To relate this to Torsten's answer, it remains to check that a matrix is conjugate to an element of $GL_n(Z_p)$ iff its char poly has integral coeffts. – Laurent Berger Nov 4 '10 at 19:24

I am going to write a community wiki answer here which people can vote up. (See this meta thread concerning the Mathoverflow user, which bumps questions with no voted-up answer.)

Main result: A homomorphism $f: \mathbb Z \to GL_n(\mathbb Q_p)$ extends continuously to $\hat{\mathbb Z}$ if and only if the image of $f$ can be conjugated into $GL_n(\mathbb Z_p)$.

Proof: If $f:\hat{\mathbb Z} \to GL_n(\mathbb Q_p)$ is continuous, the image is compact, hence contained in a maximal compact subgroup, which can be conjugated into $GL_n(\mathbb Z_p)$.

Conversely, if $f:\mathbb Z \to GL_n(\mathbb Q_p)$ lands in a compact subgroup, then the closure of the image is compact, hence profinite (any compact subgroup of $GL_n(\mathbb Q_p)$ is profinite), and hence $f$ extends to $\hat{\mathbb Z}$ (since $\hat{\mathbb Z}$ is precisely the profinite completion of $\mathbb Z$). QED

As noted in the comments, to tell if a matrix (e.g. $f(1)$) can be conjugated into $GL_n(\mathbb Z_p)$, one simply has to look at the characteristic polynomial, and ask that all the coefficients lie in $\mathbb Z_p$, with the constant term being a unit. Thus to apply the theorem in practice, one simply computes the characteristic polynomial of $f(1)$ and see if its satisfies these conditions.

EDIT: Now actually made community wiki; sorry about that --- I thought I had already clicked the CW box, but obviously not. (The point is that the above argument is just a rephrasing of what is in the comments.)

-