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
Problem Comments
4 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers42
Suggested Problems
-
Back to basics 13 - Input variables
383 Solvers
-
399 Solvers
-
Return a list sorted by number of consecutive occurrences
430 Solvers
-
The sum of the numbers in the vector
642 Solvers
-
Number of odd and even elements within matrix
160 Solvers
More from this Author54
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
In test #2: 43 = 3+2*20, I've got frob = 37. In test #3: 207 = 17+10*19. I've got frob = 175;
Got same results with Jan.
A nice place to check the results: http://mathsjavascript.free.fr/frobenius_9_page.html
My apologies gentlemen! I rushed this into print yesterday afternoon. Thanks for the reference Peng. I have fixed the offending answers.