Olympiad Number Theory

Study Sheet

Olympiad Number Theory

Orders, LTE, Vieta jumping, and valuations

The Proof-Level Toolkit

Tip
Orders and primitive roots

The order of aa mod nn divides φ(n)\varphi(n) and divides any kk with ak≡1a^k \equiv 1. Use CRT to compute orders mod composite numbers: ord1000(3)=lcm(ord8,ord125)=lcm(2,100)=100\mathrm{ord}_{1000}(3) = \mathrm{lcm}(\mathrm{ord}_8, \mathrm{ord}_{125}) = \mathrm{lcm}(2, 100) = 100. A primitive root exists mod pp, pkp^k, 2pk2p^k — and its existence converts multiplicative questions into additive ones on exponents.

Tip
Lifting the exponent

For odd prime p∣a−bp \mid a - b, p∤abp \nmid ab: vp(an−bn)=vp(a−b)+vp(n)v_p(a^n - b^n) = v_p(a - b) + v_p(n); for p∣a+bp \mid a + b and odd nn: vp(an+bn)=vp(a+b)+vp(n)v_p(a^n + b^n) = v_p(a + b) + v_p(n). The p=2p = 2 case adds v2(a+b)−1v_2(a + b) - 1 for even nn. Example: v3(2243+1)=1+5=6v_3(2^{243} + 1) = 1 + 5 = 6. LTE turns "how many times does pp divide" into arithmetic.

Tip
Vieta jumping

For a symmetric quadratic Diophantine equation, take the solution with a+ba + b minimal; Vieta gives a second root a′=kb−aa' = kb - a that yields a smaller solution unless a boundary case holds — which then proves the required structure. The IMO 1988 classic: a2+b2ab+1=k\tfrac{a^2 + b^2}{ab + 1} = k forces kk to be a perfect square.

Reminder — Vieta's formulas:  r1+r2=−ba,r1r2=car_1+r_2=-\frac{b}{a},\qquad r_1 r_2=\frac{c}{a}
Example
Worked: SFFT on a unit-fraction equation

1x+1y=112\tfrac1x + \tfrac1y = \tfrac1{12} becomes (x−12)(y−12)=144(x - 12)(y - 12) = 144; positive solutions correspond to the τ(144)=15\tau(144) = 15 divisor pairs. Simon's Favorite Factoring Trick — add the constant that completes the product — is the first thing to try on any equation with an xyxy term.

Orders and Prime Divisors of an±1a^n\pm1

Theorem
The order lemma

Let pp be a prime with p∤ap\nmid a, and let d=ord⁡p(a)d=\operatorname{ord}_p(a) be the least d≥1d\ge1 with ad≡1(modp)a^d\equiv1\pmod p. Then:

  • an≡1(modp)a^n\equiv1\pmod p if and only if d∣nd\mid n; in particular d∣p−1d\mid p-1;
  • if pp is odd and p∣an+1p\mid a^n+1, then d∣2nd\mid2n but d∤nd\nmid n, so dd contains exactly one more factor of 22 than nn — the order is even;
  • a primitive prime divisor of an−1a^n-1, one with d=nd=n, satisfies p≡1(modn)p\equiv1\pmod n.

Zsigmondy's theorem (citable at the USAMO): for a≥2a\ge2 and n≥2n\ge2, an−1a^n-1 has a primitive prime divisor except when (a,n)=(2,6)(a,n)=(2,6), or n=2n=2 and a+1a+1 is a power of 22.

Divide nn by dd: n=qd+rn=qd+r with 0≤r<d0\le r<d. Then an=(ad)qar≡ara^n=(a^d)^qa^r\equiv a^r, so an≡1a^n\equiv1 forces ar≡1a^r\equiv1, and the minimality of dd forces r=0r=0. Fermat's little theorem gives ap−1≡1a^{p-1}\equiv1, hence d∣p−1d\mid p-1. For the second item, an≡−1a^n\equiv-1 gives a2n≡1a^{2n}\equiv1, so d∣2nd\mid2n, while an≡−1≢1a^n\equiv-1\not\equiv1 (as pp is odd) gives d∤nd\nmid n. A divisor of 2n2n that does not divide nn must carry the full power of 22 in 2n2n. The third item is just n=d∣p−1n=d\mid p-1. Every problem in this section is these three lines applied to a well-chosen prime.

Example
Worked: where the factors of 232+12^{32}+1 live

Show that every prime factor of 232+12^{32}+1 is congruent to 11 modulo 6464, and use this to find a factor. (Euler, 1732)

Step 1 — let p∣232+1p\mid2^{32}+1; then pp is odd and 232≡−12^{32}\equiv-1, so 264≡12^{64}\equiv1. The order dd of 22 divides 6464 but not 3232; the divisors of 6464 are powers of 22, and the only one not dividing 3232 is 6464 itself. So d=64d=64.

Step 2 — d∣p−1d\mid p-1 gives p≡1(mod64)p\equiv1\pmod{64}.

Step 3 — search that one residue class: 64k+164k+1 for k=1,…,10k=1,\dots,10 is 65,129,193,257,321,385,449,513,577,64165,129,193,257,321,385,449,513,577,641, and the primes among them are 193,257,449,577,641193,257,449,577,641. Trial division rejects the first four, and 232+1=641⋅67004172^{32}+1=641\cdot6700417, where 6700417=64⋅104694+16700417=64\cdot104694+1 is prime — as Step 2 requires. This is how Euler refuted Fermat's guess that every 22k+12^{2^k}+1 is prime. (With quadratic residues one gets more: p≡1(mod8)p\equiv1\pmod8 makes 22 a square mod pp, so 2(p−1)/2≡12^{(p-1)/2}\equiv1, 64∣p−1264\mid\tfrac{p-1}2 and p≡1(mod128)p\equiv1\pmod{128}; indeed 641=5⋅128+1641=5\cdot128+1.)

How to find it. "Prime factors of am+1a^m+1" is a question about the order of aa. When mm is a power of 22 the order is forced completely, turning a factoring problem into a short search along one residue class.

Example
Worked: two primes, two orders

Find all pairs of primes (p,q)(p,q) such that pqpq divides (5p−2p)(5q−2q)(5^p-2^p)(5^q-2^q). (folklore)

Step 1 — both factors are odd, so pp and qq are odd. By Fermat, 5p−2p≡5−2=3(modp)5^p-2^p\equiv5-2=3\pmod p, so p∣5p−2pp\mid5^p-2^p only when p=3p=3.

Step 2 — suppose p≠3p\ne3. Then p∣5q−2qp\mid5^q-2^q; this rules out p=5p=5 (it would divide 2q2^q), so 22 and 55 are invertible mod pp. Put u≡5⋅2−1(modp)u\equiv5\cdot2^{-1}\pmod p: then uq≡1u^q\equiv1 and u≢1u\not\equiv1 (as p≠3p\ne3). The order of uu divides the prime qq and is not 11, so it is qq, and q∣p−1q\mid p-1; in particular q<pq<p.

Step 3 — by symmetry, q≠3q\ne3 would give p<qp<q. Both cannot hold, so p=3p=3 or q=3q=3; say p=3p=3.

Step 4 — 53−23=117=32⋅135^3-2^3=117=3^2\cdot13. If q=3q=3, then 9∣11729\mid117^2 and the pair works. If q≠3q\ne3, Step 1 says q∤5q−2qq\nmid5^q-2^q, so q∣117q\mid117 and q=13q=13; and 39∣11739\mid117, so (3,13)(3,13) works. The answer is (3,3)(3,3), (3,13)(3,13), (13,3)(13,3).

How to find it. The same prime in the exponent and in the modulus calls for Fermat; a prime modulus with a different prime exponent calls for the order. Two primes each dividing something indexed by the other give q∣p−1q\mid p-1 and p∣q−1p\mid q-1, which cannot both happen.

Example
Worked: IMO Shortlist 2006 N5
y mod 70123456y − 16012345y⁴+y³+y²+y+11532541
Shaded: residues 0 or 1, the only ones a divisor of the left side can have; no column is shaded twice.

Find all integers x,yx,y with

x7−1x−1=y5−1.\frac{x^7-1}{x-1}=y^5-1.

(IMO Shortlist 2006 N5)

Step 1 — the left side is Φ(x)=x6+x5+⋯+x+1\Phi(x)=x^6+x^5+\cdots+x+1. It is positive for every integer x≠1x\ne1 (x7−1x^7-1 and x−1x-1 have the same sign), so y5>1y^5>1, y≥2y\ge2, and both factors of y5−1=(y−1)(y4+y3+y2+y+1)y^5-1=(y-1)(y^4+y^3+y^2+y+1) are positive divisors of Φ(x)\Phi(x).

Step 2 — every prime p∣Φ(x)p\mid\Phi(x) is 77 or ≡1(mod7)\equiv1\pmod7. Indeed p∣x7−1p\mid x^7-1, so ord⁡p(x)\operatorname{ord}_p(x) is 11 or 77. Order 77 gives 7∣p−17\mid p-1. Order 11 means x≡1x\equiv1, and then Φ(x)≡7(modp)\Phi(x)\equiv7\pmod p, so p=7p=7.

Step 3 — a positive divisor of Φ(x)\Phi(x) is a product of such primes, hence ≡0\equiv0 or 1(mod7)1\pmod7. Apply this to y−1y-1: y≡1y\equiv1 or 2(mod7)2\pmod7.

Step 4 — then y4+y3+y2+y+1≡5y^4+y^3+y^2+y+1\equiv5 (for y≡1y\equiv1) or ≡31≡3\equiv31\equiv3 (for y≡2y\equiv2) modulo 77, which is neither 00 nor 11. Contradiction: there are no solutions.

How to find it. x7−1x−1\tfrac{x^7-1}{x-1} is a cyclotomic value, and the prime divisors of Φn(x)\Phi_n(x) are pinned by orders: nn's own prime or 1 mod n1\bmod n. The right side factors, so both factors inherit the restriction — and the table shows that no residue of yy lets both factors have it.

Side note
Where it goes wrong: p∣an−1p\mid a^n-1 is not p≡1(modn)p\equiv1\pmod n

Tempting: "p∣an−1p\mid a^n-1, so the order of aa is nn, so p≡1(modn)p\equiv1\pmod n." With a=2a=2, n=6n=6: 26−1=63=32⋅72^6-1=63=3^2\cdot7, yet neither 33 nor 77 is ≡1(mod6)\equiv1\pmod6.

The failing step is "the order is nn": p∣an−1p\mid a^n-1 gives only ord⁡p(a)∣n\operatorname{ord}_p(a)\mid n. Here ord⁡3(2)=2\operatorname{ord}_3(2)=2 and ord⁡7(2)=3\operatorname{ord}_7(2)=3 — both primes already divide the smaller numbers 22−12^2-1 and 23−12^3-1. A prime of order exactly nn is primitive, and 6363 has none: this is the exceptional case (2,6)(2,6) of Zsigmondy's theorem. A correct argument names the order dd, proves d=nd=n (or disposes of each smaller dd), and only then concludes p≡1(modn)p\equiv1\pmod n.

Try it
Try it: factor by residue class

Show that every odd prime factor of 38+13^8+1 is ≡1(mod16)\equiv1\pmod{16}, and use this to factor 38+1=65623^8+1=6562 completely.

Show the answer

If an odd prime pp divides 38+13^8+1, then 38≡−13^8\equiv-1 and 316≡13^{16}\equiv1, so ord⁡p(3)\operatorname{ord}_p(3) divides 1616 but not 88: it is 1616, and 16∣p−116\mid p-1. Now 6562=2⋅32816562=2\cdot3281. If 32813281 is composite it has a prime factor at most 3281<58\sqrt{3281}<58, and the only prime ≡1(mod16)\equiv1\pmod{16} below 5858 is 1717. Indeed 3281=17⋅1933281=17\cdot193, and 193=12⋅16+1193=12\cdot16+1 is prime. So 38+1=2⋅17⋅1933^8+1=2\cdot17\cdot193.

Vieta Jumping in Full

Tip
The Vieta jump

To prove something about a symmetric equation that is quadratic in each variable (such as a2+b2=k(ab+1)a^2+b^2=k(ab+1)), suppose it fails and take a solution in positive integers with a+ba+b minimal and a≥ba\ge b. Fix bb and read the equation as a quadratic in aa, say a2−Sa+P=0a^2-Sa+P=0. Its other root is

a′=S−a=Pa.a'=S-a=\frac{P}{a}.

The first form shows a′a' is an integer, the second shows its sign and size. If 0<a′<a0<a'<a, then (a′,b)(a',b) is a smaller solution — a contradiction — so the minimal solution must be a boundary case (a′=0a'=0, a′<0a'<0, or a=ba=b), and the boundary case carries the answer.

The descent is well-ordering: a nonempty set of positive integers has a least element, so there is no infinite chain of solutions with a+ba+b strictly decreasing. Vieta's formulas make each jump free. From one root aa of t2−St+Pt^2-St+P the other root is S−aS-a, visibly an integer, and also P/aP/a, visibly small when PP is small compared with a2a^2. Two expressions for one number supply integrality and size at once, and the jump keeps the equation because it only swaps the two roots of the same quadratic. Geometrically the solutions are lattice points on a conic, and the jumps are horizontal and vertical chords between them, walking toward the axes.

Example
Worked: which kk allow x2+y2+1=kxyx^2+y^2+1=kxy?

Find all positive integers kk for which x2+y2+1=kxyx^2+y^2+1=kxy has a solution in positive integers. (folklore)

Step 1 — fix such a kk and take a solution with x+yx+y minimal and x≥yx\ge y. If x=yx=y, the equation reads 2x2+1=kx22x^2+1=kx^2, so x2∣1x^2\mid1: x=y=1x=y=1 and k=3k=3.

Step 2 — if x>yx>y, fix yy: xx is a root of t2−ky t+(y2+1)=0t^2-ky\,t+(y^2+1)=0, whose other root is x′=ky−xx'=ky-x (an integer) and also x′=y2+1xx'=\tfrac{y^2+1}{x} (positive).

Step 3 — size: since x≥y+1x\ge y+1, x′=y2+1x≤y2+1y+1≤y<xx'=\tfrac{y^2+1}{x}\le\tfrac{y^2+1}{y+1}\le y<x. So (x′,y)(x',y) is a solution in positive integers with x′+y<x+yx'+y<x+y, contradicting minimality.

Step 4 — so the minimal solution is (1,1)(1,1) and k=3k=3; conversely k=3k=3 has the solution (1,1)(1,1). The only value is k=3k=3.

How to find it. A symmetric equation, quadratic in each variable, with a free parameter kk: jump from a minimal solution. The boundary case x=yx=y is where the parameter gets pinned.

Example
Worked: IMO 1988 Problem 6
ab10201020(30, 8)(2, 8)(2, 0)(8, 30)
A horizontal jump (30, 8) → (2, 8), then a vertical one to (2, 0): each move swaps the two roots of one quadratic.

Positive integers a,ba,b are such that ab+1ab+1 divides a2+b2a^2+b^2. Prove that a2+b2ab+1\dfrac{a^2+b^2}{ab+1} is a perfect square. (IMO 1988/6)

Step 1 — let k=a2+b2ab+1k=\tfrac{a^2+b^2}{ab+1} and suppose kk is not a perfect square. Among all pairs of positive integers with a2+b2=k(ab+1)a^2+b^2=k(ab+1), take one with a+ba+b minimal and a≥ba\ge b.

Step 2 — as a quadratic in aa it reads a2−kb a+(b2−k)=0a^2-kb\,a+(b^2-k)=0, so the other root is a′=kb−a=b2−kaa'=kb-a=\tfrac{b^2-k}{a}, an integer by the first formula.

Step 3 — a′≠0a'\ne0, since otherwise k=b2k=b^2 is a square.

Step 4 — a′>0a'>0: if a′≤−1a'\le-1, then a′b+1≤1−b≤0a'b+1\le1-b\le0, yet a′2+b2=k(a′b+1)a'^2+b^2=k(a'b+1) has a positive left side.

Step 5 — a′<aa'<a: a′=b2−ka<b2a≤b≤aa'=\tfrac{b^2-k}{a}<\tfrac{b^2}{a}\le b\le a. So (a′,b)(a',b) is a positive solution with a smaller sum, a contradiction; hence kk is a perfect square.

Step 6 — the same jumps describe all solutions: descent from any solution ends at a pair with a zero coordinate, and there k=b2k=b^2. For k=4k=4 the chain (30,8)→(2,8)→(2,0)(30,8)\to(2,8)\to(2,0) is drawn on the curve a2+b2=4(ab+1)a^2+b^2=4(ab+1).

How to find it. "ab+1ab+1 divides a2+b2a^2+b^2" is symmetric and quadratic in each variable, so jump. The descent can only stop at a′=0a'=0, and that exit is exactly the statement "k=b2k=b^2".

Side note
Where it goes wrong: the jump that lands on zero

A common write-up of IMO 1988/6 says: "the other root a′=kb−aa'=kb-a is a positive integer smaller than aa, so (a′,b)(a',b) is a smaller solution — infinite descent, contradiction." That argument never uses the assumption that kk is not a square, so it would prove that there are no solutions at all.

And there are solutions: (a,b)=(8,2)(a,b)=(8,2) gives 64+417=4\tfrac{64+4}{17}=4. The jump from (8,2)(8,2) is a′=4⋅2−8=0a'=4\cdot2-8=0, which is not positive, so it leaves the set of positive solutions and the descent stops there. The case a′=0a'=0 is exactly where the conclusion lives (b2=kb^2=k), and a proof must treat a′<0a'<0, a′=0a'=0 and a′>0a'>0 separately. A descent proof that never uses the negation of the conclusion is wrong somewhere.

Try it
Try it: jumping up

Show that x2+y2+1=3xyx^2+y^2+1=3xy has infinitely many solutions in positive integers, and list every solution with x≥yx\ge y and x≤100x\le100.

Show the answer

Jump upward. If (x,y)(x,y) is a solution with x≥yx\ge y, fix xx and read the equation as a quadratic in yy: the other root is y′=3x−y≥2x>xy'=3x-y\ge2x>x, so (3x−y, x)(3x-y,\,x) is a solution with a larger top coordinate. Starting from (1,1)(1,1) this gives (2,1)(2,1), (5,2)(5,2), (13,5)(13,5), (34,13)(34,13), (89,34)(89,34), (233,89)(233,89), and so on without end. Conversely the descent from the worked example (x↦3y−xx\mapsto3y-x) takes every solution with x>yx>y to a smaller one and ends at (1,1)(1,1), so this chain contains every solution. With x≤100x\le100: (1,1)(1,1), (2,1)(2,1), (5,2)(5,2), (13,5)(13,5), (34,13)(34,13), (89,34)(89,34) — pairs of alternate Fibonacci numbers.

Factoring: Divisor Pairs and Coprime Pieces

Tip
Two factoring principles
  • Divisor pairs. If an equation can be written A⋅B=NA\cdot B=N with A,BA,B integer expressions and N≠0N\ne0 fixed, then AA runs over the divisors of NN, negative ones included — a finite check. Simon's trick xy+ax+by=(x+b)(y+a)−abxy+ax+by=(x+b)(y+a)-ab produces this form.
  • Coprime pieces. If AB=CkAB=C^k with A,BA,B positive integers and gcd⁡(A,B)=1\gcd(A,B)=1, then AA and BB are both kk-th powers.

The first is just the finiteness of the set of divisors. The second is unique factorization: each prime p∣Cp\mid C appears in CkC^k with an exponent that is a multiple of kk, and coprimality sends all of those copies of pp to the same factor, so every prime exponent of AA (and of BB) is a multiple of kk. Without coprimality this fails (2⋅8=422\cdot8=4^2), so compute the gcd first — it usually divides a small number, and each possible gcd is a separate case. Most "find all integer solutions" equations of olympiad size are driven into one of these two forms, often after a size argument has bounded one factor.

Example
Worked: Simon's trick with signs

Find all integer solutions of xy−3x+2y=17xy-3x+2y=17.

Step 1 — complete the product: xy−3x+2y−6=(x+2)(y−3)xy-3x+2y-6=(x+2)(y-3), so the equation is (x+2)(y−3)=11(x+2)(y-3)=11.

Step 2 — 1111 is prime, so (x+2, y−3)(x+2,\,y-3) is one of (1,11)(1,11), (11,1)(11,1), (−1,−11)(-1,-11), (−11,−1)(-11,-1).

Step 3 — the solutions are (x,y)=(−1,14),(9,4),(−3,−8),(−13,2)(x,y)=(-1,14),(9,4),(-3,-8),(-13,2). Check one: 9⋅4−27+8=179\cdot4-27+8=17.

How to find it. One xyxy term plus linear terms is always Simon's trick; the constant to add is the product of the two shifts. Over the integers the negative divisor pairs are half of the answer, and forgetting them is the usual loss.

Example
Worked: a size bound on the small factor

Find all positive integers x,yx,y with x3−y3=602x^3-y^3=602.

Step 1 — factor: (x−y)(x2+xy+y2)=602=2⋅7⋅43(x-y)(x^2+xy+y^2)=602=2\cdot7\cdot43. Put d=x−yd=x-y, a positive divisor of 602602.

Step 2 — size: x2+xy+y2=d2+3xy>d2x^2+xy+y^2=d^2+3xy>d^2, so d3<602d^3<602 and d≤8d\le8; the divisors of 602602 in that range are 1,2,71,2,7.

Step 3 — in each case 3xy=602d−d23xy=\tfrac{602}{d}-d^2. For d=1d=1: xy=200xy=200 and x=y+1x=y+1, so y2+y−200=0y^2+y-200=0, whose discriminant 801801 is not a square. For d=2d=2: xy=99xy=99 and x=y+2x=y+2, so y2+2y−99=0y^2+2y-99=0, giving y=9y=9, x=11x=11. For d=7d=7: 3xy=86−49=373xy=86-49=37, not a multiple of 33.

Step 4 — the only solution is (11,9)(11,9), and 1331−729=6021331-729=602.

How to find it. A difference of cubes always factors, and the second factor dwarfs the first. That imbalance bounds the small factor and leaves a handful of divisors to test.

Example
Worked: Fermat's x4+y4=z2x^4+y^4=z^2

Prove that x4+y4=z2x^4+y^4=z^2 has no solution in positive integers. (Fermat)

Step 1 — suppose there are solutions and take one with zz minimal. Then gcd⁡(x,y)=1\gcd(x,y)=1: a common prime pp would give p4∣z2p^4\mid z^2, so p2∣zp^2\mid z, and (xp,yp,zp2)\left(\tfrac xp,\tfrac yp,\tfrac z{p^2}\right) would be a smaller solution.

Step 2 — (x2)2+(y2)2=z2(x^2)^2+(y^2)^2=z^2 is a primitive Pythagorean triple, so (swapping xx and yy if necessary) xx is odd, yy is even, and there are coprime m>n>0m>n>0 of opposite parity with x2=m2−n2x^2=m^2-n^2, y2=2mny^2=2mn, z=m2+n2z=m^2+n^2.

Step 3 — x2+n2=m2x^2+n^2=m^2 is again primitive with xx odd, so nn is even and n=2rsn=2rs, m=r2+s2m=r^2+s^2 with gcd⁡(r,s)=1\gcd(r,s)=1.

Step 4 — coprime pieces: (y2)2=mn2=rs(r2+s2)\left(\tfrac y2\right)^2=\tfrac{mn}{2}=rs(r^2+s^2), and rr, ss, r2+s2r^2+s^2 are pairwise coprime, so each is a square: r=u2r=u^2, s=v2s=v^2, r2+s2=w2r^2+s^2=w^2.

Step 5 — then u4+v4=w2u^4+v^4=w^2 is a positive solution with w≤w2=m≤m2<m2+n2=zw\le w^2=m\le m^2<m^2+n^2=z, contradicting the minimality of zz.

How to find it. A sum of two squares equal to a square is a Pythagorean triple; its parametrization produces a product equal to a square; coprime pieces make each piece a square; and the same equation reappears in smaller numbers — infinite descent. As a corollary x4+y4=z4x^4+y^4=z^4 has no solutions, the case n=4n=4 of Fermat's Last Theorem.

Side note
Where it goes wrong: coprime pieces without the gcd

Find all positive integers xx for which x(x+9)x(x+9) is a perfect square. Tempting: "the product of xx and x+9x+9 is a square, so both are squares; the only squares 99 apart are 1616 and 2525, so x=16x=16."

This misses x=3x=3: 3⋅12=363\cdot12=36. The factors 33 and 1212 are not squares because gcd⁡(x,x+9)\gcd(x,x+9) can be 33 or 99, and coprime pieces needs gcd 11. Either split into cases by the gcd, or avoid it: 4x(x+9)=(2x+9)2−814x(x+9)=(2x+9)^2-81, so x(x+9)=y2x(x+9)=y^2 becomes (2x+9−2y)(2x+9+2y)=81(2x+9-2y)(2x+9+2y)=81. The divisor pairs (1,81)(1,81) and (3,27)(3,27) give exactly x=16x=16 and x=3x=3; the pair (9,9)(9,9) gives y=0y=0.

Try it
Try it: multiply to factor

Find all pairs of positive integers (x,y)(x,y) with 2xy+x+y=522xy+x+y=52.

Show the answer

Multiply by 22 and add 11: 4xy+2x+2y+1=(2x+1)(2y+1)=105=3⋅5⋅74xy+2x+2y+1=(2x+1)(2y+1)=105=3\cdot5\cdot7. Both factors are odd and at least 33, so they form a divisor pair of 105105 other than (1,105)(1,105): (3,35)(3,35), (5,21)(5,21), (7,15)(7,15) and their reverses. Hence (x,y)=(1,17),(2,10),(3,7),(7,3),(10,2),(17,1)(x,y)=(1,17),(2,10),(3,7),(7,3),(10,2),(17,1) — six ordered pairs.