Is this algorithm efficient as a factorization algorithm?

461 Views Asked by At

Let $N=8*G+3$ $->$ $N=(4*x+2)^2-(2*y-1)^2=p*q$ with $q/p < 2$

Given this system if we choose $D^2$ odd close to $8*x+4$ $->$ $(8*x+4-D^2)=W*V$ with $V$ and $W$ odd very close to each other

Varying $K$ odd we will have $4*K=S=W+V$

Varying $W$ up to $S/2$

We will find $p$ and $q$ in $(K+1)^2/4$

If well prepared, is it efficient as a factorization algorithm?

P.S. I have used more equations than necessary to make you understand all the relationships

The system is written for sagemath

import time
Start_Time = time.time()

var('N X M D W V x B K y Y p q S')

eq0 = N-863762454800754259== 0

eq1 = (64*X^2+64*X-(2*M-16))-D^2*(W^2+V^2) == 0
eq2 = M/(D^2)-V*W  == 0
eq3 = (N-3)/8-B-(4-(D^2-7)*(D^2-5)/8)-D^2*(x-1) == 0
eq4 = 8*((N-3)/8-B)+3 -M  == 0
eq5 = 2*X+1-D*K == 0
eq6 = (D*V+D*W-4)/8-X == 0
eq7 = (4*x+2)^2-(2*y-1)^2-N == 0
eq8 = Y*(Y-1)/2-y*(y-1)/2-B == 0
eq9 = y+(D^2-(4*x+2+2*y-1))/2-Y == 0
eq10 = 8*x+4-D^2-V*W == 0
eq11 = 4*x+2-(2*y-1)-p == 0
eq12 = 4*x+2+(2*y-1)-q == 0
eq13 = ((8*(D^(-1)*(2*X+1-D^1)/2)+4-W)*W+D^2-4)/8-x == 0
eq14 = (V*W+D^2-4)/8 -x == 0
eq15 = D*(V+W-4)/8+(D-1)/2-X == 0
eq16 = W+V-S ==0
eq17 = 4*K-S ==0
eq18 = 8*(D^(-1)*(2*X+1-D^1)/2)+4-V-W == 0

eq19 = D-43113 == 0
eq20 = K-865 == 0
eq21 = W-1445 == 0



solutions = solve([eq0,eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17,eq18,eq19,eq20,eq21],N,X,M,D,W,V,x,B,K,y,Y,p,q,S)
sol = solutions  
Execution_Time = time.time() - Start_Time
print (Execution_Time)
print(sol)

In this case I chose $D=sqrt(2*sqrt(N))$

P.S. I have used more equations than necessary to make you understand all the relationships

UPDATE: if we choose $D^2 > 8*x+4$ then $W$ is negative and $V$ is positive therefore if $V$ and $W$ are very close $(V+W)/4=K$ it is very low but in this case we must set a limit for $W$

Example

eq0 = N-863762454800754259== 0

eq19 = D-43147 == 0

eq20 = K-41 == 0

eq21 = W+85 == 0
3

There are 3 best solutions below

1
On

I'll try to give an answer as a self-taught beginner, waiting for a real answer from the experts,

The algorithm is efficient for $q/p < 2$ with $D^2 > 8*x+3$ if we quickly find a $D$ with $V$ (positive) and $W$ (negative) where $D^2-(8*x+4)=V*W$ such that $V+W=4*K$ with low $K$

Or for example we could try at the same time all $D$ such that $sqrt(3*sqrt(N/2)) > D > sqrt(2*sqrt(N))$ , and if we find a $K < 10$ then we would find the solution in approximately $sqrt(sqrt(N))$

1
On

Let's change approach and introduce eq22= W^2+V^2-A==0 we find $A$ as a function of $x$ and $X$

import time
Start_Time = time.time()

var('N X M D W V x B K y Y p q S A')

eq0 = N-863762454800754259== 0

eq1 = (64*X^2+64*X-(2*M-16))-D^2*(W^2+V^2) == 0
eq2 = M/(D^2)-V*W  == 0
eq3 = (N-3)/8-B-(4-(D^2-7)*(D^2-5)/8)-D^2*(x-1) == 0
eq4 = 8*((N-3)/8-B)+3 -M  == 0
eq5 = 2*X+1-D*K == 0
eq6 = (D*V+D*W-4)/8-X == 0
eq7 = (4*x+2)^2-(2*y-1)^2-N == 0
eq8 = Y*(Y-1)/2-y*(y-1)/2-B == 0
eq9 = y+(D^2-(4*x+2+2*y-1))/2-Y == 0
eq10 = 8*x+4-D^2-V*W == 0
eq11 = 4*x+2-(2*y-1)-p == 0
eq12 = 4*x+2+(2*y-1)-q == 0
eq13 = ((8*(D^(-1)*(2*X+1-D^1)/2)+4-W)*W+D^2-4)/8-x == 0
eq14 = (V*W+D^2-4)/8 -x == 0
eq15 = D*(V+W-4)/8+(D-1)/2-X == 0
eq16 = W+V-S ==0
eq17 = 4*K-S ==0
eq18 = 8*(D^(-1)*(2*X+1-D^1)/2)+4-V-W == 0

eq19 = D-43113 == 0


eq22 = W^2+V^2-A == 0



solutions = solve([eq0,eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17,eq18,eq19,eq22],N,M,D,W,V,B,K,y,Y,p,q,S,A)
sol = solutions  
Execution_Time = time.time() - Start_Time
print (Execution_Time)
print(sol)

->

$A = 64/1858730769*X^2 + 64/1858730769*X - 16*x + 6909760128384816586/1858730769$

as you can see the value in $x$ mod $D^2 = 0$

so we will have

$64*X^2+64*X+ 6909760128384816586$ mod $D^2 = 0$

but from the equation eq5

$32*X + 6909760128384816586$ mod $D = 0$

$16*X + 3454880064192408293$ mod $D = 0$

we multiply by the first odd number greater than $D/16$ or $2695$

$43120*X+9310901772998540349635$ mod $D = 0$

but from the equation eq5

$7*X+21560$ mod $D = 0$

but from the equation eq5

$X+21557$ mod $D = 0$

therefore we will have $X=43113*t-21557$

for $t=363960$

$X=15691385923$

&

$W=1$

you will have it

import time
Start_Time = time.time()

var('N X M D W V x B K y Y p q S')

eq0 = N-863762454800754259== 0

eq1 = (64*X^2+64*X-(2*M-16))-D^2*(W^2+V^2) == 0
eq2 = M/(D^2)-V*W  == 0
eq3 = (N-3)/8-B-(4-(D^2-7)*(D^2-5)/8)-D^2*(x-1) == 0
eq4 = 8*((N-3)/8-B)+3 -M  == 0
eq5 = 2*X+1-D*K == 0
eq6 = (D*V+D*W-4)/8-X == 0
eq7 = (4*x+2)^2-(2*y-1)^2-N == 0
eq8 = Y*(Y-1)/2-y*(y-1)/2-B == 0
eq9 = y+(D^2-(4*x+2+2*y-1))/2-Y == 0
eq10 = 8*x+4-D^2-V*W == 0
eq11 = 4*x+2-(2*y-1)-p == 0
eq12 = 4*x+2+(2*y-1)-q == 0
eq13 = ((8*(D^(-1)*(2*X+1-D^1)/2)+4-W)*W+D^2-4)/8-x == 0
eq14 = (V*W+D^2-4)/8 -x == 0
eq15 = D*(V+W-4)/8+(D-1)/2-X == 0
eq16 = W+V-S ==0
eq17 = 4*K-S ==0
eq18 = 8*(D^(-1)*(2*X+1-D^1)/2)+4-V-W == 0

eq19 = D-43113 == 0
eq20 = 15691385923-X == 0
eq21 = W-1 == 0



solutions = solve([eq0,eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17,eq18,eq19,eq20,eq21],N,X,M,D,W,V,x,B,K,y,Y,p,q,S)
sol = solutions  
Execution_Time = time.time() - Start_Time
print (Execution_Time)
print(sol)

This approach is efficient for $D^2-(8*X+4)$ in low absolute value

EDIT:

if we choose $D$ prime number we could try to directly solve the diophantine

$64*X^2+64*X+ 16=d*D^2$

0
On

Let's change approach (third) and introduce eq22= W^2+V^2-A==0 we find $A$ as a function of $x$ and $X$

import time
Start_Time = time.time()

var('N X M D W V x B K y Y p q S A')

eq0 = N-863762454800754259== 0

eq1 = (64*X^2+64*X-(2*M-16))-D^2*(W^2+V^2) == 0
eq2 = M/(D^2)-V*W  == 0
eq3 = (N-3)/8-B-(4-(D^2-7)*(D^2-5)/8)-D^2*(x-1) == 0
eq4 = 8*((N-3)/8-B)+3 -M  == 0
eq5 = 2*X+1-D*K == 0
eq6 = (D*V+D*W-4)/8-X == 0
eq7 = (4*x+2)^2-(2*y-1)^2-N == 0
eq8 = Y*(Y-1)/2-y*(y-1)/2-B == 0
eq9 = y+(D^2-(4*x+2+2*y-1))/2-Y == 0
eq10 = 8*x+4-D^2-V*W == 0
eq11 = 4*x+2-(2*y-1)-p == 0
eq12 = 4*x+2+(2*y-1)-q == 0
eq13 = ((8*(D^(-1)*(2*X+1-D^1)/2)+4-W)*W+D^2-4)/8-x == 0
eq14 = (V*W+D^2-4)/8 -x == 0
eq15 = D*(V+W-4)/8+(D-1)/2-X == 0
eq16 = W+V-S ==0
eq17 = 4*K-S ==0
eq18 = 8*(D^(-1)*(2*X+1-D^1)/2)+4-V-W == 0

eq19 = D-43113 == 0


eq22 = W^2+V^2-A == 0



solutions = solve([eq0,eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17,eq18,eq19,eq22],N,M,D,W,V,B,K,y,Y,p,q,S,A)
sol = solutions  
Execution_Time = time.time() - Start_Time
print (Execution_Time)
print(sol)

->

$A = 64/1858730769*X^2 + 64/1858730769*X - 16*x + 6909760128384816586/1858730769$

as you can see the value in $x$ mod $D^2 = 0$

so we will have

$64*X^2+64*X+ 6909760128384816586$ mod $D^2 = 0$

I tried with smaller numbers and it seems to have $D$ solutions like

$X=n*D^2+(D-1)/2+D*h$

with $h$ from $0$ to $D-1$

if so then

$15691385923=n*D^2+(D-1)/2+D*h$ ,$D=43113$

for $h=19055$ & $n=8$

i.e. it means that we will factorize $N$ into $8*D$