hermann on Mon, 13 Jan 2025 01:46:10 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: What’s the equivalent of Mathematica’s Solve[] Function in Pari/Gp ?


On 2025-01-12 22:07, Thomas D. Dean wrote:
On 1/12/25 03:14, Bill Allombert wrote:
On Sun, Jan 12, 2025 at 11:46:43AM +0100, Laël Cellier wrote:
No,

it stops after finding the first solution instead of returning every
possible values and that’s what I’m needing.

Given the size of the solution it cannot just try all integers until finding
one that works, it must do something smarter.

And even if gcdext was the
solution, how would I be able to use it since the equation contains a ==
sign ?

Every equation contains a equal sign by definition.

Set
RSA260=22112825529529666435281085255026230927612089502470015394413748319128822941402001986512729726569746599085900330031400051170742204560859276357953757185954298838958709229238491006703034124620545784566413664540684214361293017694020846391065875914794251435144458199

F=(sqrtint(RSA260)+1)^2

You want to solve

((25)^2 + x RSA260)/(y) == F

after multiplying by y one get:

x*RSA260 -F*y == -(25^2)

Compute
[X,Y,d]=gcdext(RSA260,F)
we find d=1 so
X*RSA260 + Y*F == 1
So you just need to multiply by -(25^2)
-(25^2)*X*RSA260 -(25^2)*Y*F == -(25^2)
hence the solution is

x = -(25^2)*X
y = (25^2)*Y

Mathematica indicates there are an infinite number of solutions in the
integers by including the constant C[1] in the solution. Maple uses
_Z1.

Tom Dean

I did show complete output with C[1] in previous posting:

https://pari.math.u-bordeaux.fr/archives/pari-users-2501/msg00002.html

Mathematica is not good in simplifying the condition:

(C[1] ∈ Integers && C[1] >= 0) || (C[1] ∈ Integers && C[1] <= -1)

is equivalent to

(C[1] ∈ Integers)