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.


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

Solution Stats

67.27% Correct | 32.73% Incorrect
Last Solution submitted on Apr 24, 2020

Problem Comments