Problem 42888. Frobenius McNugget Factorization

Mr. Frobenius McNugget is a peculiar man.

As you might expect, he likes to eat Chicken McNuggets. But his love of number theory influences his appetite in strange ways. On any given day he wakes up with a desire for a specific number of McNuggets. If that number is 19, then no other number of McNuggets will do. But the McFastFood restaurant down the street serves McNuggets only in quantities of 6, 9, or 20 to a box. So he can be satisfied on a 21 nugget day, but on a 19 nugget day he must go hungry. To make matters more interesting, the restaurant often changes the quantities in their boxed McNuggets.

Given the box counts nuggets, what is the highest number frob for which Frobenius must go hungry? nuggets is a vector of positive integers with two or more elements.

Examples

 nuggets = [2 5]
 frob = 3
 nuggets = [6 9 20]
 frob = 43

Solution Stats

66.67% Correct | 33.33% Incorrect
Last Solution submitted on Aug 27, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers21

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!