# Tag Info

6

Much faster to solve for $r$ and check that it's an integer: (it's always rational; no square-roots involved) Solve[(a(a+3)(a(r-5)+(12-r)))/9 == (b(9+b(-14+r)-r))/3, r] // FullSimplify (* {{r -> (a(3+a)(-12+5a)+3(9-14b)b)/((-1+a)a(3+a)-3(-1+b)b)}} *) R = (a(3+a)(-12+5a)+3(9-14b)b)/((-1+a)a(3+a)-3(-1+b)b); With[{s = 10^3}, Do[If[IntegerQ[R] &&...

3

Try NSolve with restricted parameter range 1<= a,b,r <=50 NSolve[{1/9 a (a + 3) (a (r - 5) + 12 - r) ==1/3 b (9 + b (-14 + r) - r) , 50 >= a >= 1, 50 >= b >= 1 ,50 > r >= 1}, {a, b, r}, Integers] (**{{a -> 3, b -> 6, r -> 24}, {a -> 5, b -> 10, r -> 31}, {a -> 5,b -> 14, r -> 19}, {a -> 9, b -> 20, ...

3

Borrowing a fast perfect-square test from Fastest square number test, and shortening the length of the test case: (* OP's *) Table[ If[IntegerQ[ FullSimplify[ Sqrt[3*((4 a (3 + a) (12 + a (-5 + r) - r) (-14 + r) + 3 (-9 + r)^2)/(-14 + r)^2)]]], {a, r}, Nothing], {a, 1, 300}, {r, 3, 30}] // Flatten[#, 1] & // ...

2

primeVectors[max_, tries_] := Catch[Module[ {a, b, done = False, tt = 0, u, v, egcd}, While[! done && tt < tries, tt++; {a, b} = RandomInteger[{2, max}, 2]; egcd = ExtendedGCD[a, b]; If[egcd[] =!= 1, Continue[]]; {u, v} = {1, -1}*egcd[]; If[u < 0, {u, v} = {u, v} + {b, -a}; If[u < 0, Continue[]]]; ...

1

The excellent second solution by Roman, with R slightly modified, produces R = HornerForm[(a (3 + a) (-12 + 5 a) + 3 (9 - 14 b) b)/ ((-1 + a) a (3 + a) - 3 (-1 + b) b)] With[{s = 10^4}, Do[If[Divisible[a (3 + a) (-12 + 5 a) + 3 (9 - 14 b) b, (-1 + a) a (3 + a) - 3 (-1 + b) b] && R >= 3, Sow[{a, b, R}]], {a, s}, {b, s}] // Reap // ...

Only top voted, non community-wiki answers of a minimum length are eligible