I want to write the $p-$adic expansion of $6!$ in $\mathbb{Q}_3$.
I have to solve the congruence $x \equiv 6! \pmod {3^n}$, right?
I found the following:
$$x_0 \equiv 6! \pmod 3 \Rightarrow x_0 \equiv 0 \pmod 3$$
$$x_1 \equiv 6! \pmod {3^2} \Rightarrow x_1 \equiv 0 \pmod {3^2}$$
$$x_2 \equiv 6! \pmod {3^3} \Rightarrow x_2 \equiv 18 \pmod {3^3}$$
$$x_3 \equiv 6! \pmod {3^4} \Rightarrow x_3 \equiv 72 \pmod {3^4}$$
Using the formula $x_n=\sum_{i=0}^n a_i 3^i$, I found: $a_0=0,a_1=0,a_2=2,a_3=2$.
Is there a theorem I could use, in order to find the coefficients of the infinite series?
A theorem that states, for example, that the solutions we find are periodic?
Every $p$-adic number has a well-defined $p$-adic expansion. When we take an element of $\mathbb{Z}$ and represent it in $\mathbb{Q}_p$, we have very little to do.
You are asking about $6! = 720$ in $\mathbb{Q}_3$. The coefficient of $3^n$ will be $720 \pmod {3^n}$. For $n \geq 6$, we see that $3^n > 720$. So the coefficients for all $3^n$ with $n \geq 6$ will be $720$. It is characteristic of the (normal) integers that they have finite (in this sense) expansions.
You are just left with finding the coefficients for the other $n \leq 5$. Quickly, we see that $$\begin{align} 720 &\equiv 0 &\pmod 3\\ &\equiv 0 &\pmod {3^2}\\ &\equiv 18 &\pmod {3^3}\\ &\equiv 72 &\pmod {3^4}\\ & \equiv 234 &\pmod{3^5}\end{align}$$
and this gives us the entire expansion.