Thomas D. Dean on Sun, 12 Jan 2025 22:07:53 +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 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