To solve T^2-W*(2*h+1)^2=1 and Y^2-3*X^2=-(3*(2*h+1)^2*W+2) What procedure does sagemath use? And what is the computational cost?

asked 2025-01-30 18:10:39 +0100

Periodic_1_6 gravatar image

updated 2025-01-30 20:24:05 +0100

factorization and generalized Pell equation

In some cases if

    N=p*q

    3*N=M=6*G+3=(2*a+1)^2-(2*b)^2

then

    3*x^2-6*x-4*y^2-4*y=M

it is true that (x+y)= p or -p or q or -q



Example

    N=55

    3*x^2-6*x-4*y^2-4*y=165

    solve 3*x^2-6*x-4*y^2-4*y=165 ,x

    x-1=sqrt[(4*y^2+4*y+168)/3]

    Y=2*y+1 ; X=x-1

    ->

    Y^2-3*X^2=-167

    X=8 ; Y=5

    ->

    x=9 ; y=2

    x+y=11


if we can transform a generic number W in polynomial time into 3*(2*h+1)*W=3*N=3*x^2-6*x-4*y^2-4*y` with `x+y=p or `-p or q or -w
we have solved the factorization problem


so


If we can transforms a generic number W such that (2*h+1)*W=N satisfies

    3*T^2-1 =3*(2*h+1)*W+2

the factorization is quite easy 

to do this I thought of looking for instead of (2*h+1)*W=N to lead to the Pell equation (2*h+1)^2*W=N

    3*T^2-1 =3*(2*h+1)^2*W+2

    T^2-W*(2*h+1)^2=1

So it's Pell again

Example

    W=91

    T^2-W*(2*h+1)^2=1

    T^2-91*(2*h+1)^2=1

    ->

    h=82

    3*x^2-6*x-4*y^2-4*y=3*(2*h+1)^2*W

    3*x^2-6*x-4*y^2-4*y=3*(2*82+1)^2*91

    Y^2-3*X^2=-(3*(2*h+1)^2*W+2)

    Y^2-3*X^2=-(3*(2*82+1)^2*91+2)

    ->

    X=-1574 ; Y=1

    ->

    x=-1573 ;y=0

    gcd(1573,91)=13

Question:

To solve

T^2-W*(2*h+1)^2=1

and

Y^2-3*X^2=-(3*(2*h+1)^2*W+2)

knowing W

What procedure does sagemath use?

And what is the computational cost?

edit retag flag offensive close merge delete

Comments

Please clarify what is given and with respect to what variables you want to solve your equations.

Max Alekseyev gravatar imageMax Alekseyev ( 2025-01-30 19:55:31 +0100 )edit

@Max Alekseyev I tried to explain better (sorry for my English)

Periodic_1_6 gravatar imagePeriodic_1_6 ( 2025-01-30 20:26:03 +0100 )edit

@Max Alekseyev I'm testing some numbers and it seems for many of them Y=1 -> y=0

Periodic_1_6 gravatar imagePeriodic_1_6 ( 2025-01-31 19:10:58 +0100 )edit