3
$\begingroup$

When I try to solve:

Solve[y^2==441+48*x*(1+x)(-13+16*x)&&1100*10^9<=y<=1200*10^9&&x>=2,{y,x},Integers]

My code runs for 169 seconds and spits out {} which means that it didn't find any solutions. Now when I change my code to:

Solve[y^2==441+48*x*(1+x)(-13+16*x)&&1200*10^9<=y<=1400*10^9&&x>=2,{y,x},Integers]

I get the following failure (Solve::svars error):

enter image description here

Question: is there a way to solve for larger values of $y$ without getting that failure?

$\endgroup$
7
$\begingroup$

Hmm, I just posted an answer yesterday that overcame just this problem with the undocumented option "SolveDiscreteSolutionBound" that controls a system limit:

With[{ropts = SystemOptions["ReduceOptions"]},
  Internal`WithLocalSettings[
   SetSystemOptions[
    "ReduceOptions" -> "SolveDiscreteSolutionBound" -> (1400*10^9)],
   Solve[y^2 == 441 + 48*x*(1 + x) (-13 + 16*x) && 
     1200*10^9 <= y <= 1400*10^9 && x >= 2, {y, x}, Integers],
   SetSystemOptions[ropts]
   ]] // AbsoluteTiming
(* {406.301, {}}  -- i.e., no solutions found *)

I thought I might need to set the bound to (1400*10^9)^2 because of the y^2 in the equation, but I guess by "SolutionBound", they really mean the bound on the solution, namely, x and y.

$\endgroup$
4
$\begingroup$

Here's a direct search using a fast square test from this answer:

sQ[n_] := FractionalPart@Sqrt[n + 0``1] == 0

Reap[Do[If[sQ[441 + 48*x*(1 + x) (-13 + 16*x)], Sow[x]], {x, 2*10^7}]][[2,1]] //AbsoluteTiming

(*    {91.0767, {1}}    *)

So in 91 seconds we've checked up to $x\le2\times10^7$, which corresponds to $y\le2478\times10^9$.

Using parallel processing, I searched up to $x\le10^9$ and found no more solutions:

search[x1_Integer, x2_Integer] := Module[{},
  Print[{x1, x2}];
  Flatten[Reap[Do[If[sQ[441 + 48*x*(1 + x) (-13 + 16*x)], Sow[x]], {x,x1,x2}]][[2]]]]

Union @@ Parallelize[
  search @@@ BlockMap[# - {0, 1} &, Range[0, 1000] 10^6 + 1, 2, 1], 
  Method -> "FinestGrained"]

(*    {1}    *)
$\endgroup$
  • $\begingroup$ And if I want to check $x$ between $10^5$ and $10^9$ how do I do that? $\endgroup$ – Jan Jan 7 at 19:05
  • 2
    $\begingroup$ I used that in the Q&A I linked to in my answer, too, and in a comment to @Okkes's answer. This is the 3rd elliptic curve Q in the last two days, that I've noticed. $\endgroup$ – Michael E2 Jan 7 at 19:07
  • 1
    $\begingroup$ @Jan please see the documentation for Do. You can do {x, 10^5, 10^9} for example. This will take a while though. $\endgroup$ – Roman Jan 7 at 19:09
  • $\begingroup$ In your edited, you say that you checked $x$ until $10^9$ but I do not see that number back in your code. Where did you put that bound? Can here also be used a lower and an upper bound of $x$, so like $10^5\le x\le10^9$ $\endgroup$ – Jan Jan 7 at 21:18
  • 1
    $\begingroup$ @Jan Try breaking it down like this: Execute Range[0, 1000] 10^6 + 1 and then BlockMap[# - {0, 1} &, Range[0, 1000] 10^6 + 1, 2, 1] -- maybe look up BlockMap if you don't understand what it's doing. And then maybe execute "f" @@@ BlockMap[# - {0, 1} &, Range[0, 1000] 10^6 + 1, 2, 1] and imagine what happens when "f" is replaced by search. Note @@@ is a form of Apply, which you can also look up if it's unfamiliar. $\endgroup$ – Michael E2 Jan 8 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.