<s>[INST] $p$-adic structure of Pell-type equations As an example, consider an integer solution of $ x ^ 2-3y ^ 2 = 13 $.
$ y $ that satisfies this equation is
$y_k = \frac {(4+ \sqrt {3}) (2+ \sqrt {3}) ^ k-(4- \sqrt {3}) (2- \sqrt {3}) ^ k} { 2 \sqrt {3}} $
for any integer $ k $.
By  calculation
$ 3 | y_k \Leftrightarrow k \equiv1 \mod 3 $
$ 3 ^ 2 | y_k \Leftrightarrow k \equiv7 \mod 3 ^ 2 $
$ 3 ^ 3 | y_k \Leftrightarrow k \equiv7 \mod 3 ^ 3 $
$ 3 ^ 4 | y_k \Leftrightarrow k \equiv7 \mod 3 ^ 4 $
$ 3 ^ 5 | y_k \Leftrightarrow k \equiv7+2\cdot 3^4 \mod 3 ^ 5 $
$ 3 ^ 6 | y_k \Leftrightarrow k \equiv7+2\cdot 3^4+2\cdot 3^5 \mod 3 ^ 6 $
You can see that it has a regular structure.
In other words, a solution divisible by $3^d$ appear at intervals of $3$ powers and do not appear anywhere else.
I tried similar calculations for other Pell-type equations, and I was convinced that they had a similar structure.
Can you prove this structure in general?
We consider the Pell-type equation $ x ^ 2-py ^ 2 = N $ with a solution. For any $ d $
$ p ^ d | y_k \Leftrightarrow k \equiv r \mod p^{d+e}. $
$ r $ should be uniquely determined as $ p $-adic number.
 [/INST] As $d$ gets larger and $p^d|y_k$, this can be thought of as taking the limit as $y \to 0$ in the p-adics, since $\lim_{d \to \infty}|p^d|_p=0$. So in your equation we're looking at solving just $x^2=N$.
Since in your specific problem you're interested in $k$, we can set $y_k=0$ and solve for $k$,
$$0 = \frac {(4+ \sqrt {3}) (2+ \sqrt {3}) ^ k-(4- \sqrt {3}) (2- \sqrt {3}) ^ k} { 2 \sqrt {3}} $$
$$k=\frac{\log \frac{4- \sqrt {3}}{4+ \sqrt {3}}}{\log \frac{2+ \sqrt {3}}{2- \sqrt {3}}}$$
This gets us exactly the digits you have so far (rewriting $7=1+2\cdot 3$ of course)
$$k = 1 + 2\cdot 3 + 2\cdot 3^4 + 2\cdot 3^5 + 2\cdot 3^6 + 3^7 + 3^8 + \dots$$
For your convenience, here is the sage code I used to compute it almost exactly copied from here:
R = Zp(3, 10)
S.<x> = ZZ[]
f = x^2 - 3
W.<w> = R.ext(f)
log((4-w)/(4+w))/log((2+w)/(2-w))

The general case follows identically, and I leave it to you.
</s>