3

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?

Michael E2
  • 235,386
  • 17
  • 334
  • 747
Jan Eerland
  • 2,001
  • 10
  • 17

2 Answers2

7

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.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
4

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}    *)
Roman
  • 47,322
  • 2
  • 55
  • 121
  • And if I want to check $x$ between $10^5$ and $10^9$ how do I do that? – Jan Eerland Jan 07 '20 at 19:05
  • 2
    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. – Michael E2 Jan 07 '20 at 19:07
  • 1
    @Jan please see the documentation for Do. You can do {x, 10^5, 10^9} for example. This will take a while though. – Roman Jan 07 '20 at 19:09
  • 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$ – Jan Eerland Jan 07 '20 at 21:18
  • @Jan look at the part Range[0, 1000]*10^6. I can only show you how; I cannot understand it for you. – Roman Jan 07 '20 at 21:29
  • @Roman Oh yes I see. What is the reason that you put the 1000 inside the range function? – Jan Eerland Jan 07 '20 at 21:30
  • 1
    @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. – Michael E2 Jan 08 '20 at 04:57