Let me try to cut through the fog of the comments to your question.
Your conjecture is true, but only for natural integers (elements of $\Bbb Z$) if you’re thinking of the standard $p$-ary expansion of real numbers. Let’s take $5$, as a not-atypical prime, for our $p$.
Look at the $5$-ary representation of $20$ and $5/4$ here. Twenty is $40_5$, and your method works. But for the rational number $5/4$, the standard $5$-ary expansion is $1.11111\cdots_5$, and you can check this with the formula for geometric series, since you’ve written $1+\frac15+\frac1{25}+\cdots$, $a=1$, $r=\frac15$, so $a/(1-r)=1/(1-\frac15)=5/4$. For $5/4$, then, your method doesn’t work.
On the other hand, if you write $5$-adic numbers as $5$-ary expansions extending (potentially) infinitely to the left, then $\frac54$ has the expnsion $\cdots333340_5$, and your method works fine.
(You check that my $5$-adic expansion is correct by noticing that it represents $20+3(25+125+625+\cdots)$, and the infinite part evaluates as $\frac{75}{1-5}=-18\frac34$, just right.)
A couple of remarks more on your question: in the expansion of twenty, I would have called the rightmost digit the zero-th position, and the $4$ to appear in the first position. Then your formula would involve $n$ instead of $n-1$. And for algebraic extensions of $\Bbb Q_p$, like $\Bbb Q_5(\sqrt2\,)$, you will always need as many $p$-adic coordinates as the degree of your field over the base, just as we need two real numbers to describe a complex number.