Here is a variation that works:
{x, y} /. Solve[
x+y==150 && x==30p && y==30q && 0<x<=y && GCD[p,q]==1,
{x, y, p, q},
Integers
]
{{30, 120}, {60, 90}}
Addendum
(For the more complicated example)
Since GCD[GCD[x,y], GCD[y,z]]==5
is equivalent to GCD[x,y,z]==5
, your more complicated example could be done using:
FindInstance[
{
x+y+z==15000, x==5p, y==5q, z==5r, GCD[p,q,r]==1, 0<x<=y<=z
},
{x,y,z,p,q,r},
Integers
]
{{x -> 5, y -> 5, z -> 14990, p -> 1, q -> 1, r -> 2998}}
A faster alternative that yields all (reverse) ordered solutions for this particular example is:
With[{parts = IntegerPartitions[3000, {3}]},
5 Pick[parts, GCD @@@ parts, 1]
] //Short
{{14990,5,5},{14985,10,5},{14980,15,5},{14975,20,5},<<479993>>,{5010,5005,4985},{5005,5005,4990},{5005,5000,4995}}
Solve[{x + y == 150, p*x + q*y == 30}, {x, y, p, q}, Integers]
. $\endgroup$ – anderstood Mar 23 '18 at 20:53{x,y}
"solutions" that have gcd a strict divisor of 30. $\endgroup$ – Daniel Lichtblau Mar 23 '18 at 21:44