Originally Posted by

**Jenny20** Find a solution in positive integers to :

a) x^2 -41y^2 = -1

b)x^2 - 41y^2 =1

Could you please teach me how to solve these two questions? Thank you very much.

This the variant Pell's equation and Pell's equation. The solutions can be

derived from the continued fraction expansion of sqrt(41).

If a=[a_0: a_1,...] is the CF expansion of sqrt(41) and p_n/q_n is the n-th

convergent of a, then the solutions of a) and b) will be among {(p_n,q_n), n=0,1, ..}.

The following calculations show the solutions:

Code:

>{cf,r}=CF(sqrt(41),8);cf
Column 1 to 6:
6 2 2 12 2 2
Column 7 to 8:
12 2
>
>{p,q,xx}=cnvrgntCT(cf);p,q
Column 1 to 6:
6 13 32 397 826 2049
Column 7 to 8:
25414 52877
Column 1 to 6:
1 2 5 62 129 320
Column 7 to 8:
3969 8258
>
>
>p^2-41*q^2
Column 1 to 6:
-5 5 -1 5 -5 1
Column 7 to 8:
-5 5
>
>

or in tabular form:

Code:

n a p q p^2-41q^2
0 6 6 1 -5
1 2 13 2 5
2 2 32 5 -1
3 12 397 62 5
4 2 826 129 -5
5 2 2049 320 1
6 12 25414 3969 -5
7 2 52877 8258 5

So we see that x=32, y=5 is a solution to a), and that x=2049 y=320 is

a solution to b).

RonL