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 vending machine takes tokens worth 7 units and 11 units and gives no change…
HardMathematicsHigh School (11–12)Number TheoryNumericalOlympiad

A vending machine takes tokens worth 7 units and 11 units and gives no change…

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 vending machine takes tokens worth 777 units and 111111 units and gives no change. Ayaan wants to pay exactly 350350350 units, using any number of each kind of token, zero included. Find how many different ways he can pay. Then find the smallest number of tokens he can use, and say why the number of 111111-unit tokens must be a multiple of 777.

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. 7x+11y=3507x + 11y = 3507x+11y=350 with x,y≥0x, y \ge 0x,y≥0.

Step 1. A condition on yyy. 7x7x7x and 350350350 are multiples of 777, so 11y11y11y is too. Since gcd⁡(7,11)=1\gcd(7, 11) = 1gcd(7,11)=1, 7∣y7 \mid y7∣y.

Step 2. List. y=0,7,14,21,28y = 0, 7, 14, 21, 28y=0,7,14,21,28 give x=50,39,28,17,6x = 50, 39, 28, 17, 6x=50,39,28,17,6. The next value, y=35y = 35y=35, gives 11×35=385>35011 \times 35 = 385 > 35011×35=385>350.

Step 3. Count. There are 555 ways.

Step 4. Fewest tokens. The totals x+yx + yx+y are 50,46,42,38,3450, 46, 42, 38, 3450,46,42,38,34. Each step down the list swaps 111111 small tokens for 777 large ones. The fewest is 6+28=346 + 28 = 346+28=34.

Check. 7×6+11×28=42+308=3507 \times 6 + 11 \times 28 = 42 + 308 = 3507×6+11×28=42+308=350.

Answer: 555 ways, and the fewest tokens is 343434.

Log in to save this for later
← All Problems
← Prove that if p is a prime with p ≡ 1 pmod 4, then x = ((p - 1)/2)! …Stamps come in values of 5 units and 8 units… →
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 →