HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A gardener spends exactly 345 units on plants: shrubs at 13 units each and herbs at 8 units each…
HardMathematicsHigh School (11–12)Number TheoryNumericalOlympiad

A gardener spends exactly 345 units on plants: shrubs at 13 units each and herbs at 8 units each…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A gardener spends exactly 345345345 units on plants: shrubs at 131313 units each and herbs at 888 units each, buying at least one of each. Find a solution of 13x+8y=34513x + 8y = 34513x+8y=345 by the Euclidean algorithm, write the general solution, and use it to find every solution with xxx and yyy positive. Give the number of such solutions and the smallest possible number of shrubs.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

ax+by=cax + by = cax+by=c has integer solutions exactly when d=gcd⁡(a,b)∣cd = \gcd(a, b) \mid cd=gcd(a,b)∣c. From one solution (x0,y0)(x_0, y_0)(x0​,y0​), all are

x=x0+bdt,y=y0−adt.\displaystyle x = x_0 + \tfrac{b}{d}t, \qquad y = y_0 - \tfrac{a}{d}t.x=x0​+db​t,y=y0​−da​t.

For coprime a,ba, ba,b the largest nnn that is not ax+byax + byax+by with x,y≥0x, y \ge 0x,y≥0 is ab−a−bab - a - bab−a−b.

The worked solution

Check an answer or open a hint to unlock the worked solution.

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Given. 13x+8y=34513x + 8y = 34513x+8y=345 with x,y≥1x, y \ge 1x,y≥1.

Step 1. Bezout. Working back: 1=3−2=2×3−5=2×8−3×5=5×8−3×131 = 3 - 2 = 2 \times 3 - 5 = 2 \times 8 - 3 \times 5 = 5 \times 8 - 3 \times 131=3−2=2×3−5=2×8−3×5=5×8−3×13.

Step 2. One solution. Multiply by 345345345: 13×(−1035)+8×1725=34513 \times (-1035) + 8 \times 1725 = 34513×(−1035)+8×1725=345.

Step 3. All solutions. x=−1035+8tx = -1035 + 8tx=−1035+8t, y=1725−13ty = 1725 - 13ty=1725−13t.

Step 4. Positive. x>0x > 0x>0 needs 8t>10358t > 10358t>1035, so t≥130t \ge 130t≥130. y>0y > 0y>0 needs 13t<172513t < 172513t<1725, so t≤132t \le 132t≤132.

Step 5. List. t=130,131,132t = 130, 131, 132t=130,131,132 give (5,35)(5, 35)(5,35), (13,22)(13, 22)(13,22), (21,9)(21, 9)(21,9).

Check. 13×13+8×22=169+176=34513 \times 13 + 8 \times 22 = 169 + 176 = 34513×13+8×22=169+176=345.

Answer: 333 positive solutions, with at least 555 shrubs.

Log in to save this for later
← All Problems
← Stamps come in values of 5 units and 8 units…A carpenter has a straight piece of length 24 cm for one leg of a right triangle… →
More onNumber Theory

Discussion (0)

Log in to join the discussion.

Loading…

More on this topic

  1. The triangular numbers are 1, 3, 6, 10, …, where the nth one is (n(n + 1))/2…Advanced
  2. Prove that the equation x³ + y³ + z³ = n has no solution in integers when n leaves remainder 4 or 5…Advanced
  3. Find every triple of positive integers a ≤ b ≤ c with 1/a + 1/b + 1/c = 1, and prove that there are…Advanced
  4. Find all pairs of positive integers (x, y) with x² - y² = 945…Hard
  5. A teacher wants a list of every primitive Pythagorean triple whose hypotenuse is less than 100…Advanced
All problems on this topic →