2025 AIME II Problem 8
Problem 8 of 15IntermediateNumber TheoryArithmeticProblem-Solving Techniques
From an unlimited supply of -cent coins, -cent coins, and -cent coins, Silas wants to find a collection of coins that has a total value of cents, where is a positive integer. He uses the so-called greedy algorithm, successively choosing the coin of greatest value that does not cause the value of his collection to exceed For example, to get cents, Silas will choose a -cent coin, then a -cent coin, then -cent coins. However, this collection of coins uses more coins than necessary to get a total of cents; indeed, choosing -cent coins and -cent coins achieves the same total value with only coins.
In general, the greedy algorithm succeeds for a given if no other collection of -cent, -cent, and -cent coins gives a total value of cents using strictly fewer coins than the collection given by the greedy algorithm. Find the number of values of between and inclusive for which the greedy algorithm succeeds.
Your answer
Integer from 0 to 999
Show solution
Solution
In any optimal collection there are at most pennies (ten pennies could become a dime) and at most dimes (five dimes could become two quarters), so its dimes and pennies are worth at most cents. Hence an optimal collection uses either quarters, like greedy, or quarters. For an amount made only of dimes and pennies, the best count is which is what greedy does on the remainder.
Let Greedy uses coins, and the only rival uses coins (possible when ), so greedy fails exactly when Tabulating: for for for for for So greedy fails exactly when and
Each residue class mod contains values of in so these residues give values, of which the values less than do not count (there ). Greedy fails for values and succeeds for
Tagged: optimization · money · modular arithmetic · casework