Ask Your Question
0

How does sagemath solve X*a*b+Y*a+Y*b+Z mod N = 0 knowing X,Y,Z,N without factoring N? Is there a computationally efficient way to solve this?

asked 2025-08-26 08:57:29 +0200

Periodic_1_6 gravatar image

If N=(6a+1)(6*b+1)

C=(N-1)/6

A=(2*C^2+C) mod N

B=N-A

(-16C^2-8C-1) mod N =X

(-B+16C^3+6C^2) mod N =Y

(-12C^4-4C^3+A*B) mod N=Z

we get

Xab+Ya+Yb+Z=N*W

so

Xab+Ya+Yb+Z mod N = 0

How does sagemath solve Xab+Ya+Yb+Z mod N = 0 knowing X,Y,Z,N without factoring N? Is there a computationally efficient way to solve this?

Example: N=403=13*31

179ab+97a+97b+352 mod 403 = 0

edit retag flag offensive close merge delete

Comments

This is equivalent to factorization of N. So, the answer is "impossible".

Max Alekseyev gravatar imageMax Alekseyev ( 2025-08-26 15:29:14 +0200 )edit
Max Alekseyev gravatar imageMax Alekseyev ( 2025-08-26 15:33:32 +0200 )edit

If we found

(Xc-Nd)=36n+u && (Yc-Nf)=6n+v

such that

u<36; uab+va+vb < h*N

where h is the computational cost

with u mod 6 != 0

Example

(179c-403d)=36n+3 , (97c-403f)=6n+v , n=-51*c-168 ,c=-100 ,v=202

(364932+3)ab+(64932+202)a+(64932+202)b+264=403W ,a=2,b=5

W=4932 + |_(3ab+202*(a+b))/403_| - |_4932/403_|+1

W=4932+3-12+1

|_(3ab+202*(a+b))/403_|=3 is h

If we found u and v to be small numbers, then we could factor N.

What do you think?

Periodic_1_6 gravatar imagePeriodic_1_6 ( 2025-08-27 11:57:01 +0200 )edit

I think this is off-topic here.

Max Alekseyev gravatar imageMax Alekseyev ( 2025-09-05 00:46:00 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2025-08-31 19:13:52 +0200

Periodic_1_6 gravatar image

The method I propose is coccinella's bruteforce.

If N=(6a+1)(6*b+1) and a and b are odd and such that a mod 8 = b mod 8

We must find

X and Y such that

Ya=8G+3 : Yb=8F+3

X is of the same order of magnitude as N (or even a few missing digits are fine)

N mod X is as low as possible and Y is as low as possible or as close as possible to X (such that (X-Y)a and (X-Y)b are of the same order of magnitude as X).

Example: N=2449=31*79

2449-(31*79-1)/6=2041

ab+2041a+2041b+2381=2449W

a mod 8 = b mod 8 = 5

So we need to find Y mod 8 = 7

Let's try X = 1245

12452041 mod 2449 = 1432 (1432-1245=187 -> 187a and 187*b are of the same order as X, so it's fine)

1432 mod 8 = 0 (remember, we need to subtract 1)

So the new equation will be

1245ab+1432a+1432b+1055=2449*V

2449V-1055-a-b-(2(1431-1245)/2)^2-(2(1431-1245)/2)(a-1431)-(2(1431-1245)/2)^2-(2 (1431-1245)/2)(b-1431)=1245W

187a+187b+41V+1055=1245j , 1245ab+1432a+1432b+1055=2449V , (6a+1)(6b+1)=2449 , j=5

-> a=5 ; b=13

Now I'll explain this to you

2449V-1055-a-b-(2(1431-1245)/2)^2-(2(1431-1245)/2)(a-1431)-(2(1431-1245)/2)^2-(2(1431-1245)/2)(b-1431)=1245W

pq=8G+3 and such that

pq-(2(q-X)/2)^2-(2(q-X)/2)(p-q)=X*(p+q-X)

In our case, p=a & p=b & q=1431

edit flag offensive delete link more

Comments

How is this relevant to Sage?

Max Alekseyev gravatar imageMax Alekseyev ( 2025-09-05 00:45:45 +0200 )edit

@Max Alekseyev could be implemented in sagemath

Periodic_1_6 gravatar imagePeriodic_1_6 ( 2025-09-05 14:51:41 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2025-08-26 08:57:29 +0200

Seen: 8,855 times

Last updated: Aug 31