TITLE: Solve quadratic equation with condition that solution should be integer.
QUESTION [0 upvotes]: $$x^2+\left(\frac{30y-8}{9}\right)x+\frac{6y^2-2y}{3}=0$$ both $x$ and $y$ should be integer.

REPLY [2 votes]: The way I wrote the Pell type equation splits into two sequences of solutions:
First, in solving $w^2 - 7 v^2 = 9,$ begin with
$$ w_0 = 11 \; , \; \; v_0 = 4 \; , \;  $$
$$ w_2 = 2741 \; , \; \; v_2 = 1036 \; , \;  $$
$$ w_4 = 696203 \; , \; \; v_4 = 263140 \; , \;  $$
and continue with
$$ w_{n+4} = 254 w_{n+2} - w_n \; , \;   $$
$$ v_{n+4} = 254 v_{n+2} - v_n \; , \;   $$
Then we find $x,y$ with the pair $(w,v)$ and
$$ y = \frac{11-w}{21}  \; , \;  $$
followed by
$$ x = \frac{4-15y-v}{9}  \; , \;  $$
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Second, in solving $w^2 - 7 v^2 = 9,$ begin with
$$ w_1 = 53 \; , \; \; v_1 = -20 \; , \;  $$
$$ w_3 = 13451 \; , \; \; v_3 = -5084 \; , \;  $$
$$ w_5 = 3416501 \; , \; \; v_5 = -1291316 \; , \;  $$
and continue with
$$ w_{n+4} = 254 w_{n+2} - w_n \; , \;   $$
$$ v_{n+4} = 254 v_{n+2} - v_n \; , \;   $$
Then we find $x,y$ with the pair $(w,v)$ and
$$ y = \frac{11-w}{21}  \; , \;  $$
followed by
$$ x = \frac{4-15y-v}{9}  \; , \;  $$
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Together, these give all the solutions, see the fine list in the earlier answer by Dmitry Ezhov. By numbering the $w_n$ and $v_n$ in this way, we can actually produce (program) the list in proper order. 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
jagy@phobeusjunior:~$ 
jagy@phobeusjunior:~$ ./mse

Fri Nov 15 13:58:47 PST 2019

 n: 0 w: 11  v: 4  x: 0 y: 0
 n: 1 w: 53  v: -20  x: 6 y: -2
 n: 2 w: 2741  v: 1036  x: 102 y: -130
 n: 3 w: 13451  v: -5084  x: 1632 y: -640
 n: 4 w: 696203  v: 263140  x: 26016 y: -33152
 n: 5 w: 3416501  v: -1291316  x: 414630 y: -162690
 n: 6 w: 176832821  v: 66836524  x: 6608070 y: -8420610
 n: 7 w: 867777803  v: -327989180  x: 105314496 y: -41322752
 n: 8 w: 44914840331  v: 16976213956  x: 1678423872 y: -2138801920
 n: 9 w: 220412145461  v: -83307960404  x: 26749467462 y: -10495816450
 n: 10 w: 11408192611253  v: 4311891508300  x: 426313055526 y: -543247267202
 n: 11 w: 55983817169291  v: -21159893953436  x: 6794259420960 y: -2665896055680
 n: 12 w: 2897636008417931  v: 1095203466894244  x: 108281837679840 y: -137982667067520
 n: 13 w: 14219669148854453  v: -5374529756212340  x: 1725715143456486 y: -677127102326402
 n: 14 w: 735988137945543221  v: 278177368699629676  x: 27503160457623942 y: -35047054187883010
 n: 15 w: 3611739979991861771  v: -1365109398183980924  x: 438324852178526592 y: -171987618094850560
 n: 16 w: 186938089402159560203  v: 70655956446239043460  x: 6985694474398801536 y: -8901813781055217152
 n: 17 w: 917367735248784035381  v: -346732412608974942356  x: 111332786738202297990 y: -43684177868989715970
 n: 18 w: 47481538720010582748341  v: 17946334759976017409164  x: 1774338893336837966310 y: -2261025653333837273730
 n: 19 w: 233007793013211153125003  v: -88068667693281451377500  x: 28278089506651205162976 y: -11095609191105293005952
 n: 20 w: 12060123896793285858518411  v: 4558298373077462182884196  x: 450675093213082444641312 y: -574291614133013612310400
 n: 21 w: 59183062057620384109715381  v: -22369094861680879674942644  x: 7182523401902667909098022 y: -2818241050362875433795970
 n: 22 w: 3063223988246774597480928053  v: 1157789840426915418435176620  x: 114469699337229604100927046 y: -145867808964132123689568002
 n: 23 w: 15032264754842564352714581771  v: -5681662026199250155984054076  x: 1824332665993770997705734720 y: -715822131182979254891170560
 n: 24 w: 778046832890783954474297207051  v: 294074061170063438820351977284  x: 29074852956563106359190828480 y: -37049849185275426403537962240
 n: 25 w: 3818136064667953725205394054453  v: -1443119785559747858740274792660  x: 463373314639015930749347520966 y: -181816003079426367866923526402
 n: 26 w: 197620832330270877661874009662901  v: 74693653747355686544950967053516  x: 7384898181267691785630369506982 y: -9410515825250994174374952841090
 n: 27 w: 969791528160905403637817375249291  v: -366546743870149756869873813281564  x: 117694997585644052639336564590752 y: -46180548960043114458943684535680
 n: 28 w: 50194913365055912142161524157169803  v: 18971893977767174318978725279615780  x: 1875735063189037150443754663945056 y: -2390233969764567244864834483674752
 n: 29 w: 246323230016805304570280407919265461  v: -93101429823232478497089208298724596  x: 29894066013438950354460738058530150 y: -11729677619847871646203828948536450
 n: 30 w: 12749310373891871413231365261911467061  v: 4818786376699114921334051270055354604  x: 476429321151834168520928054272537350 y: -607110017804374829201493583900546050
 n: 31 w: 62565130632740386455447585794118177803  v: -23647396628357179388503789034062765820  x: 7592975072415907745980388130302067456 y: -2979291934892399355021313609243722752
 n: 32 w: 3238274640055170283048624615001355463691  v: 1223952767787597422844530043868780453636  x: 121011171837502689767165282030560541952 y: -154203554288341442049934505476255022080
 n: 33 w: 15891296857486041354379116511298097896501  v: -6006345642172900332201465325443643793684  x: 1928585774327627128528664124358666603782 y: -756728421785049588303767452918957042690

Fri Nov 15 13:58:47 PST 2019

jagy@phobeusjunior:~$ 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
int main()
{
  cout << endl;
  system("date");
  cout << endl;

mpz_class w0,w1,w2,w3,w;
mpz_class v0,v1,v2,v3,v;
mpz_class x,y;

  w0 = 11;  v0 = 4;
  w = w0; v = v0;
  y = ( 11 - w) / 21;
  x = ( 4 - 15 * y - v) / 9;

cout  << " n: " << 0 << " w: " << w << "  v: " << v << "  x: " << x << " y: " << y << endl;


  w1 = 53;  v1 = -20;
  w = w1; v = v1;
  y = ( 11 - w) / 21;
  x = ( 4 - 15 * y - v) / 9;

cout  << " n: " << 1 << " w: " << w << "  v: " << v << "  x: " << x << " y: " << y << endl;



  w2 = 2741;  v2 = 1036;
  w = w2; v = v2;
  y = ( 11 - w) / 21;
  x = ( 4 - 15 * y - v) / 9;

cout  << " n: " << 2 << " w: " << w << "  v: " << v << "  x: " << x << " y: " << y << endl;


  w3 = 13451;  v3 = -5084;
  w = w3; v = v3;
  y = ( 11 - w) / 21;
  x = ( 4 - 15 * y - v) / 9;

cout  << " n: " << 3 << " w: " << w << "  v: " << v << "  x: " << x << " y: " << y << endl;


for(int n = 4; n <= 33; ++n) {


w = 254 * w2 - w0;
v = 254 * v2 - v0;
  y = ( 11 - w) / 21;
  x = ( 4 - 15 * y - v) / 9;

cout << " n: " << n << " w: " << w << "  v: " << v << "  x: " << x << " y: " << y << endl;
 w0 = w1; w1 = w2; w2 = w3; w3 = w;

  v0 = v1; v1 = v2; v2 = v3; v3 = v;



} // n


   cout << endl;
  system("date");
  cout << endl;

  return 0;
}

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
{"set_name": "stack_exchange", "score": 0, "question_id": 3433696}