McNugget numbers
Chicken McNuggets used to come in boxes of 6, 9 and 20. You could buy 15 (6 + 9) or 26 (6 + 20), but not 43, however you mixed the boxes. 43 is the largest count you can't buy, and past it every count works. Below, each count you can buy is a node, with an arrow from each smaller count it's one box more than.
Boxes of
Why it stops at 43
Look at 44 to 49: 44 = 20 + 9 + 9 + 6, 45 = 9 + 9 + 9 + 9 + 9, and so on. That's six counts in a row, so adding boxes of 6 to them reaches 50 to 55, then 56 to 61, and every count after. Once some count and the next five can be bought, nothing above them is missing. The largest count you can't buy is the Frobenius number of the box sizes, and for 6, 9 and 20 it's 43.
Things to try
- Add the small box. Later the menu got a box of 4. Set the first box to 4 and the largest count you can't buy drops to 23. With all four sizes, 4, 6, 9 and 20, it's 11.
- Make every box even. With 6, 10 and 20, no odd count can be bought, so there's no largest. The graph only ever reaches even numbers.
- Two boxes. Set the last two boxes to 7, so there are only two sizes. For two sizes a and b with no common factor, the largest count you can't buy is ab − a − b, so 6 and 7 give 29.
- Watch the graph grow. Drag the count up slowly. Each new count starts next to the one it comes from, and the colors say which box it adds.
How it's built
- No script. The page is markup: four
<t-num>s, a few<t-let>s and a<t-graph>. - One table, two uses. The
<t-let>calledwaysworks out, for each count, the fewest boxes that make it and which count it extends. With the fewest boxes, the graph draws one edge per count, back to that one, so the edges form a tree from 0. Following a hovered count back along the tree gives its boxes. - Every way. The
<t-choice>setsevery, which the graph's expression reads. Then each count gets an arrow from every count one box below it, and the tree's arrows stay thicker. The nodes are the same either way, so toggling only rewires the arrows, and each arrow's id is its two counts, so the tree's arrows are the same elements in both views. - The graph keeps its shape. The nodes' ids are the counts, so raising the limit adds nodes without moving the old ones. Changing a box size rewires the edges, and the graph settles again.
- Zoom for the labels. With
zoom, ⌘ or Ctrl and the scroll wheel zoom in, which helps at 200 nuggets with every way shown. - The colors match. Each
<t-num>box has acolor, and the edges use the same palette by number:color: boxes.indexOf(way.box) + 1. - The largest gap comes from a second table that runs to 1,000. With box sizes up to 30 and no common factor, the Frobenius number is always below 1,000.
Ported from the McNugget demo in wigglystuff.