# $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.

• You have half of the $y$ values; suggest finding the first few by hand. $\; \; y_{j+4} = 4 y_{j+2} - y_j. \; \;$ More orbits with $x^2 - 3 y^2 = 481$ because $481 = 13 \cdot 37$ Jul 25 at 14:52

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.

• Did you mean ${\log \dfrac{4\color{red}- \sqrt {3}}{4\color{red}+ \sqrt {3}}}$? Jul 25 at 14:23
• @J.W.Tanner Ah yes, fixed now. Jul 25 at 14:29
• @Merosity Thank you for your wonderful post. You're probably using the log in $\mathbb{Q}_p (\sqrt{p})$. The finite extension of $p$-adic field is a local field with characteristic 0. I saw in Neukirch's book that there is a log in the local field. I will do my best to understand. Jul 25 at 14:51
• @Kazsugi Yes exactly, and fortunately you don't need a special series to do that, the regular series $\log(1+x)=\sum_{n=1}^\infty \frac{(-1)^{n-1}}{n}x^n$ converges for all $|x|_p<1$. As a quick check that we are plugging in within this region of convergence, $\left|\frac{4-\sqrt{3}}{4+\sqrt{3}}-1\right|_3 = \frac{|-2\sqrt{3}|_3}{|4+\sqrt{3}|_3} = 3^{-1/2}<1$. Jul 25 at 15:22

just an example showing that a single formula of the type you used may not suffice. Below are the first several solutions to $$x^2 - 3 y^2 = 481$$ which is a product or represented primes. The recurrence is $$y_{j+8} = 4 y_{j+4} - y_j$$ The number 4 is the trace of the automorphism generator matrix

jagy@phobeusjunior:~\$ ./Pell_Target_Fundamental 3 2 1 481  10  Automorphism matrix:
2   3
1   2
Automorphism backwards:
2   -3
-1   2

2^2 - 3 1^2 = 1

w^2 - 3 v^2 = 481 =  13 37

Sun Jul 25 08:03:56 PDT 2021

1. x:  22      y: 1  SEED   KEEP +-
2. x:  23      y: 4  SEED   KEEP +-
3. x:  34      y: 15  SEED   BACK ONE STEP  23 ,  -4
4. x:  41      y: 20  SEED   BACK ONE STEP  22 ,  -1
5. x:  47      y: 24
6. x:  58      y: 31
7. x:  113      y: 64
8. x:  142      y: 81
9. x:  166      y: 95
10. x:  209      y: 120
11. x:  418      y: 241
12. x:  527      y: 304
13. x:  617      y: 356
14. x:  778      y: 449
15. x:  1559      y: 900
16. x:  1966      y: 1135
17. x:  2302      y: 1329
18. x:  2903      y: 1676
19. x:  5818      y: 3359
20. x:  7337      y: 4236
21. x:  8591      y: 4960
22. x:  10834      y: 6255
23. x:  21713      y: 12536
24. x:  27382      y: 15809
25. x:  32062      y: 18511
26. x:  40433      y: 23344
27. x:  81034      y: 46785
28. x:  102191      y: 59000
29. x:  119657      y: 69084
30. x:  150898      y: 87121
31. x:  302423      y: 174604
32. x:  381382      y: 220191
33. x:  446566      y: 257825
34. x:  563159      y: 325140
35. x:  1128658      y: 651631
36. x:  1423337      y: 821764
37. x:  1666607      y: 962216
38. x:  2101738      y: 1213439
39. x:  4212209      y: 2431920
40. x:  5311966      y: 3066865
41. x:  6219862      y: 3591039

Sun Jul 25 08:04:06 PDT 2021

w^2 - 3 v^2 = 481 =  13 37

22,  23,  34,  41,  47,  58,  113,  142,  166,  209,
418,  527,  617,  778,  1559,  1966,  2302,  2903,  5818,  7337,
8591,  10834,  21713,  27382,  32062,  40433,  81034,  102191,  119657,  150898,
302423,  381382,  446566,  563159,  1128658,  1423337,  1666607,  2101738,  4212209,  5311966,
6219862,

1,  4,  15,  20,  24,  31,  64,  81,  95,  120,
241,  304,  356,  449,  900,  1135,  1329,  1676,  3359,  4236,
4960,  6255,  12536,  15809,  18511,  23344,  46785,  59000,  69084,  87121,
174604,  220191,  257825,  325140,  651631,  821764,  962216,  1213439,  2431920,  3066865,
3591039,

• Thank you for the example. There are some cases where it doesn't work. There may be cases where the log does not converge. Jul 28 at 7:09