{
 "license": "CC BY 4.0 — https://creativecommons.org/licenses/by/4.0/",
 "attribution": "Wheel Cue (wheelcue.com)",
 "source": "https://wheelcue.com/research/how-many-houses-for-every-halloween-candy/",
 "slug": "how-many-houses-for-every-halloween-candy",
 "generatedAt": "2026-10-10T19:59:08.988Z",
 "node": "v24.21.0",
 "randomJsSha256": "946e82a3c426d698779d3246c37c732f771db3873c93239ef3952aea39be1e2d",
 "totalSpins": 89559808,
 "wheelSpins": 89559808,
 "rawDraws": 89559809,
 "seconds": 120.3,
 "checksTotal": 37,
 "checksPassed": 37,
 "checksSimulatedVsExact": 37,
 "methodChecks": 27,
 "params": {
  "bag": {
   "source": "src/data/templates.mjs: templates/halloween-wheel, preset 'candy-bag' (CANDY_BAG)",
   "preset": {
    "page": "/templates/halloween-wheel/",
    "presetId": "candy-bag",
    "chip": "Candy bag (math)",
    "intro": "A pretend bag of 20 pieces in 8 kinds, some much rarer than others, for a math lesson on chance. No real candy is needed: each spin is one house.",
    "link": "/templates/halloween-wheel/#candy-bag"
   },
   "lines": [
    "Chocolate bar",
    "Lollipop",
    "Gummy bears",
    "Caramel",
    "Chocolate bar",
    "Sour chews",
    "Lollipop",
    "Toffee",
    "Chocolate bar",
    "Gummy bears",
    "Mints",
    "Lollipop",
    "Chocolate bar",
    "Caramel",
    "Sour chews",
    "Gummy bears",
    "Chocolate bar",
    "Toffee",
    "Lollipop",
    "Candy corn"
   ],
   "totalPieces": 20,
   "kinds": [
    {
     "name": "Chocolate bar",
     "pieces": 5
    },
    {
     "name": "Lollipop",
     "pieces": 4
    },
    {
     "name": "Gummy bears",
     "pieces": 3
    },
    {
     "name": "Caramel",
     "pieces": 2
    },
    {
     "name": "Sour chews",
     "pieces": 2
    },
    {
     "name": "Toffee",
     "pieces": 2
    },
    {
     "name": "Mints",
     "pieces": 1
    },
    {
     "name": "Candy corn",
     "pieces": 1
    }
   ],
   "rule": "one line per piece, every line weight 1 (Weighted choices off, the default), 'Remove the winner after each spin' off (the default): each spin picks one of the 20 lines with chance 1/20, so a kind with c pieces has chance c/20"
  },
  "evenBag": {
   "lines": [
    "Chocolate bar",
    "Lollipop",
    "Gummy bears",
    "Caramel",
    "Sour chews",
    "Toffee",
    "Mints",
    "Candy corn"
   ],
   "rule": "the same 8 kinds, one line each: every kind has chance 1/8 (the equal-chance case; the names-on-a-wheel version is the study how-many-spins-until-everyone-gets-a-turn)"
  },
  "movedPiece": {
   "from": "Chocolate bar",
   "to": "Candy corn",
   "lines": [
    "Chocolate bar",
    "Lollipop",
    "Gummy bears",
    "Caramel",
    "Chocolate bar",
    "Sour chews",
    "Lollipop",
    "Toffee",
    "Chocolate bar",
    "Gummy bears",
    "Mints",
    "Lollipop",
    "Chocolate bar",
    "Caramel",
    "Sour chews",
    "Gummy bears",
    "Candy corn",
    "Toffee",
    "Lollipop",
    "Candy corn"
   ],
   "kinds": [
    {
     "name": "Chocolate bar",
     "pieces": 4
    },
    {
     "name": "Lollipop",
     "pieces": 4
    },
    {
     "name": "Gummy bears",
     "pieces": 3
    },
    {
     "name": "Caramel",
     "pieces": 2
    },
    {
     "name": "Sour chews",
     "pieces": 2
    },
    {
     "name": "Toffee",
     "pieces": 2
    },
    {
     "name": "Mints",
     "pieces": 1
    },
    {
     "name": "Candy corn",
     "pieces": 2
    }
   ],
   "rule": "the last 'Chocolate bar' line becomes 'Candy corn'; still 20 lines"
  },
  "favorites": {
   "common": "Chocolate bar",
   "rare": "Candy corn",
   "pieces": [
    1,
    3
   ]
  },
  "onePieceKinds": [
   "Mints",
   "Candy corn"
  ],
  "routes": [
   10,
   15,
   20,
   25,
   30,
   40,
   50,
   60,
   75,
   100
  ],
  "checkedRoutes": [
   20,
   30,
   40,
   50
  ],
  "kids": [
   1,
   2,
   3,
   4
  ],
  "model": "each house gives each child one piece chosen at random from the same bag (the bowl does not run out): one spin of the Candy bag wheel per piece. With m children walking together, a house is m spins, one per child: house h is every child's h-th spin. Pooled: the children put their candy together; 'one set between them' = every kind at least once in the pooled haul; 'a full set each after trading' = every kind at least m times, so the children can trade until everyone holds a complete set. Alone: each child keeps their own bag; 'every child alone until the last has a set' = every child has their own full set. In class, a pair matches m = 2 only if each partner spins once per house (the house counts the pair's turns, two spins); a pair sharing one wheel with one spin per house is the one-child model.",
  "nights": {
   "candy": 400000,
   "even": 200000,
   "moved": 200000,
   "pooled": {
    "2": 150000,
    "3": 120000,
    "4": 100000
   }
  },
  "chart": {
   "housesFrom": 8,
   "housesTo": 100
  },
  "widgetCheck": {
   "defaultKids": 1,
   "defaultHouses": 30,
   "routes": [
    20,
    30,
    50
   ]
  },
  "exact": {
   "tailBound": 1e-10
  }
 },
 "notes": {
  "simulatedVsExact": "results holds simulated spins (never site usage); theory holds exact values only (BigInt counts, exact fractions, an exact BigInt DP with a stated truncation bound) and is identical on every run. Quote theory values; call results values 'simulated'. Simulated values not listed in checks (results.candyBag.pLastByKind, pAtMinimum, the favorite 'first' waits other than the most common kind, pCommonThreeWithin10, results.pooling rows' aloneEachMean, pAloneAllWithin30, pPooledOneSetWithin30, pPooledSetEachWithin20, results.*.pWithin at unchecked routes, the simulated pmf) are reported for comparison only; each has an exact counterpart in theory.",
  "siteBehavior": "Halloween wheel (/templates/halloween-wheel/): five list chips above the wheel; the fifth, 'Candy bag (math)' (preset id 'candy-bag'; /templates/halloween-wheel/#candy-bag selects it), loads the 20 lines of CANDY_BAG, one piece per line. Template options are the defaults: 'Remove the winner after each spin' OFF, 'Weighted choices' OFF. With all weights equal the odds line under the wheel shows three separate parts with no punctuation between them: '20 entries', 'each has a 1 in 20 chance (5%)' and 'drawn with crypto.getRandomValues()' (app.js syncOdds; pct prints 5% without decimals; display.oddsLine). Each spin is one CueRandom.pickWeighted() over the weights of the lines (app.js spin). RESULT CARD: it shows 'Probability 5%' for EVERY pick, because the chance is per slice (one line): a Chocolate bar pick also shows 5%, not 25%; a kind's chance is its pieces x 5%. The card's buttons are 'Spin again' and 'Remove & spin' (plus 'Copy result', 'Send result'): use 'Spin again'; 'Remove & spin' takes that slice off the wheel and breaks the model (the bowl must not run out). RESULTS PANEL: lists only the latest 40 spins (#n, label, 5%); on 27.9% of nights (exact, display.candy.moreThan40) a full set takes more than 40 houses and the early houses scroll off, so tally on the board or use 'Copy' (it copies every spin since the page was opened or last cleared: #, Result, Probability, Spin ID, Time). 'Clear' empties the list and restarts the #n numbering, so after Clear #n equals the house number. WEIGHTS: with Weighted choices ON, a line 'Chocolate bar *5' (or 'Chocolate bar x5', the x after a space) is one slice with weight 5 (1 to 999): the same chances as five separate lines. With Weighted choices OFF, 'Chocolate bar x5' and 'Chocolate bar *5' are each ONE slice of weight 1. A line 'Chocolate bar 5' (the widget's calculator format) is never read as a weight: it is a slice named 'Chocolate bar 5'. Pasting the widget's lines, or the prose shorthand display.bag, into the wheel without the right syntax gives 8 equal slices, the even bag (21.7 houses on average instead of 34.6), with no warning. PAIRS: for the m = 2 numbers each partner spins once per house (two spins per house, tallies kept in step); a pair sharing one wheel with one spin per house is the one-child model. The Halloween page's section 'Trick-or-treat math with the candy bag' gives the 4-step class activity and links to this study once it is published.",
  "spins": "totalSpins = wheelSpins = CueRandom.pickWeighted() calls: one per piece of candy handed out (one per spin of the Candy bag wheel; with m children, m per house). rawDraws counts 32-bit numbers from crypto.getRandomValues(), including the few the rejection step discards.",
  "checks": "Each check: z = (simulated - exact)/se, pass when |z| <= 4 (tolerance = 4 se). A share's se uses its exact p; an average's se uses the exact SD of the quantity (from its exact distribution), except the pieces of one kind at completion, where the sample SD is used. methodChecks (in theory) compare two exact methods and must all pass or the script stops; they are not in this list.",
  "rounding": "Probabilities to 6 decimals (4 significant digits below 1e-4; theory.candyBagPmf included), except pAtMinimum, given to 6 significant digits; averages to 4; a probability within 5e-7 of 1 prints as 1 in the number fields, so quote the display strings, which never say 100% unless exact. Houses are counted from 1; a child who gets a full set at the 8th house has visited 8 houses."
 },
 "display": {
  "bag": "Chocolate bar x5, Lollipop x4, Gummy bears x3, Caramel x2, Sour chews x2, Toffee x2, Mints x1, Candy corn x1",
  "bagNote": "'bag' is prose shorthand for the article (pieces of each kind), not lines to paste: on the wheel, keep one line per piece, or turn on Weighted choices and use wheelWeightedLines; the widget's own format is 'Chocolate bar 5' (theory.widgetAnchors.defaults.lines), which the wheel does not read as a weight.",
  "wheelWeightedLines": [
   "Chocolate bar *5",
   "Lollipop *4",
   "Gummy bears *3",
   "Caramel *2",
   "Sour chews *2",
   "Toffee *2",
   "Mints *1",
   "Candy corn *1"
  ],
  "link": "/templates/halloween-wheel/#candy-bag",
  "oddsLine": [
   "20 entries",
   "each has a 1 in 20 chance (5%)",
   "drawn with crypto.getRandomValues()"
  ],
  "oddsLineNote": "The three parts are separate spans on the page, shown side by side with no punctuation between them. Quote one part at a time ('each has a 1 in 20 chance (5%)'), or paraphrase without quotation marks.",
  "resultCardProbability": "Probability 5%",
  "candy": {
   "meanHouses": "34.6",
   "median": 30,
   "p10": 16,
   "p90": 60,
   "medianWording": "about half of nights finish within 30 houses (52.5%); 47.5% need more than 30; within 29: 49.96%",
   "p90Wording": "9 nights in 10 finish within 60 houses (90.46%; within 59: 89.94%)",
   "within": {
    "10": "0.90%",
    "15": "9.13%",
    "20": "23.5%",
    "25": "38.9%",
    "30": "52.5%",
    "40": "72.1%",
    "50": "83.7%",
    "60": "90.46%",
    "75": "95.66%",
    "100": "98.81%"
   },
   "moreThan40": "27.9%",
   "moreThan50": "16.3%",
   "atMinimum": "1 in 1,323",
   "duplicates": "26.6",
   "lastIsOnePiece": "62.9%",
   "commonAtCompletion": "8.6",
   "kindsAtCompletion": [
    {
     "kind": "Chocolate bar",
     "pieces": "8.6",
     "duplicates": "7.6"
    },
    {
     "kind": "Lollipop",
     "pieces": "6.9",
     "duplicates": "5.9"
    },
    {
     "kind": "Gummy bears",
     "pieces": "5.2",
     "duplicates": "4.2"
    },
    {
     "kind": "Caramel",
     "pieces": "3.5",
     "duplicates": "2.5"
    },
    {
     "kind": "Sour chews",
     "pieces": "3.5",
     "duplicates": "2.5"
    },
    {
     "kind": "Toffee",
     "pieces": "3.5",
     "duplicates": "2.5"
    },
    {
     "kind": "Mints",
     "pieces": "1.7",
     "duplicates": "0.7"
    },
    {
     "kind": "Candy corn",
     "pieces": "1.7",
     "duplicates": "0.7"
    }
   ],
   "kindsAtCompletionNote": "pieces = pieces of that kind in the bag when the set is complete, the first one included; duplicates = pieces of that kind beyond the first. duplicates (above) = the extras of ALL kinds together."
  },
  "even": {
   "meanHouses": "21.7",
   "median": 20,
   "p90": 33,
   "within": {
    "10": "2.82%",
    "15": "24.8%",
    "20": "53.1%",
    "25": "73.7%",
    "30": "85.9%",
    "40": "96.20%",
    "50": "98.99%",
    "60": "99.73%",
    "75": "99.96%",
    "100": ">99.99%"
   },
   "atMinimum": "1 in 416"
  },
  "moved": {
   "meanHouses": "29.6",
   "median": 25,
   "p90": 50,
   "within": {
    "10": "1.43%",
    "15": "13.7%",
    "20": "32.8%",
    "25": "50.6%",
    "30": "64.5%",
    "40": "81.8%",
    "50": "90.34%",
    "60": "94.69%",
    "75": "97.72%",
    "100": "99.40%"
   },
   "savedHouses": "4.9"
  },
  "rare": {
   "firstRare": "20.0",
   "allOnePiece": "30.0",
   "allOtherKinds": "19.9",
   "fullSet": "34.6",
   "shareOfWait": "86.8%"
  },
  "pooling": [
   {
    "kids": 1,
    "aloneEach": "34.6",
    "aloneAll": "34.6",
    "pooledOneSet": "34.6",
    "pooledSetEach": "34.6",
    "aloneAllWithin30": "52.5%",
    "pooledSetEachWithin30": "52.5%"
   },
   {
    "kids": 2,
    "aloneEach": "34.6",
    "aloneAll": "44.5",
    "pooledOneSet": "17.5",
    "pooledSetEach": "29.7",
    "aloneAllWithin30": "27.5%",
    "pooledSetEachWithin30": "62.0%"
   },
   {
    "kids": 3,
    "aloneEach": "34.6",
    "aloneAll": "50.9",
    "pooledOneSet": "11.9",
    "pooledSetEach": "27.7",
    "aloneAllWithin30": "14.5%",
    "pooledSetEachWithin30": "68.2%"
   },
   {
    "kids": 4,
    "aloneEach": "34.6",
    "aloneAll": "55.7",
    "pooledOneSet": "9.0",
    "pooledSetEach": "26.5",
    "aloneAllWithin30": "7.58%",
    "pooledSetEachWithin30": "72.6%"
   }
  ],
  "favorites": {
   "common": [
    {
     "pieces": 1,
     "meanHouses": "4.0",
     "median": 3,
     "p90": 9
    },
    {
     "pieces": 3,
     "meanHouses": "12.0",
     "median": 11,
     "p90": 20
    }
   ],
   "rare": [
    {
     "pieces": 1,
     "meanHouses": "20.0",
     "median": 14,
     "p90": 45,
     "within30": "78.5%"
    },
    {
     "pieces": 3,
     "meanHouses": "60.0",
     "median": 54,
     "p90": 105,
     "within30": "18.8%"
    }
   ]
  },
  "poolingColumns": {
   "aloneEach": "one child alone: houses until that child has a full set (the same for every m)",
   "aloneAll": "every child alone until the last has a set: houses until EVERY child has their own full set, no trading",
   "pooledOneSet": "one set between them: the pooled haul holds every kind at least once (ONE set for the whole group, not a set each)",
   "pooledSetEach": "a full set each after trading: the pooled haul holds every kind at least m times"
  },
  "note": "Houses to one decimal. Shares: two decimals below 10% or above 90%, one decimal between; never 100% or 0% unless exact: above 99.99% prints as '>99.99%', below 0.01% as '<0.01%'. pooling: name each column as in poolingColumns ('one set between them', 'a full set each after trading', 'every child alone until the last has a set'); pooledOneSet is never 'a set each'. Quote exact values from theory; simulated values from results must be called 'simulated'. totalSpins counts spins of the wheel (one per piece of candy), so the default label 'simulated spins' is right."
 },
 "theory": {
  "evenBag": {
   "kinds": 8,
   "chanceEach": "1/8",
   "meanHouses": 21.7429,
   "meanFraction": "761/35",
   "sd": 8.7185,
   "median": 20,
   "p10": 13,
   "p90": 33,
   "percentileEdges": {
    "median": {
     "houses": 20,
     "pWithinBefore": 0.478348,
     "pWithin": 0.530558,
     "pMoreThan": 0.469442,
     "displayWithinBefore": "47.83%",
     "displayWithin": "53.06%",
     "displayMoreThan": "46.94%"
    },
    "p90": {
     "houses": 33,
     "pWithinBefore": 0.891278,
     "pWithin": 0.90452,
     "pMoreThan": 0.09548,
     "displayWithinBefore": "89.13%",
     "displayWithin": "90.45%",
     "displayMoreThan": "9.55%"
    }
   },
   "pWithin": {
    "10": 0.028163,
    "15": 0.248248,
    "20": 0.530558,
    "25": 0.736649,
    "30": 0.859301,
    "40": 0.961962,
    "50": 0.989935,
    "60": 0.997349,
    "75": 0.999642,
    "100": 0.999987
   },
   "displayWithin": {
    "10": "2.82%",
    "15": "24.8%",
    "20": "53.1%",
    "25": "73.7%",
    "30": "85.9%",
    "40": "96.20%",
    "50": "98.99%",
    "60": "99.73%",
    "75": "99.96%",
    "100": ">99.99%"
   },
   "minHouses": 8,
   "pAtMinimum": 0.00240326,
   "displayAtMinimum": "0.24%",
   "oneInAtMinimum": "1 in 416",
   "pMoreThan50": 0.010065,
   "displayMoreThan50": "1.01%",
   "duplicatesWhenComplete": 13.7429,
   "note": "Exact. 8 kinds with equal chances (the same kinds, one line each). Average = 8 * (1 + 1/2 + ... + 1/8). Percentiles: the smallest number of houses h with P(full set within h) >= 50% (median), >= 90% (p90), >= 10% (p10). percentileEdges gives the exact chance within h - 1 and within h on both sides of the median and the p90 (display strings with two decimals, so 49.96% never prints as 50.0%), because they can sit on a knife edge: word the median as 'about half finish within h houses' (pWithin) and the p90 as '9 nights in 10 finish within h houses', never 'half need more than h' (that share is pMoreThan, below 50%). pAtMinimum is given to 6 significant digits."
  },
  "candyBag": {
   "kinds": [
    {
     "name": "Chocolate bar",
     "pieces": 5,
     "chance": 0.25,
     "chanceFraction": "1/4",
     "chanceDisplay": "5 in 20 (25%)",
     "pLast": 0.009808,
     "pLastFraction": "456655/46558512",
     "displayLast": "0.98%",
     "expectedPiecesWhenComplete": 8.6376,
     "expectedDuplicatesWhenComplete": 7.6376
    },
    {
     "name": "Lollipop",
     "pieces": 4,
     "chance": 0.2,
     "chanceFraction": "1/5",
     "chanceDisplay": "4 in 20 (20%)",
     "pLast": 0.019152,
     "pLastFraction": "557303/29099070",
     "displayLast": "1.92%",
     "expectedPiecesWhenComplete": 6.9101,
     "expectedDuplicatesWhenComplete": 5.9101
    },
    {
     "name": "Gummy bears",
     "pieces": 3,
     "chance": 0.15,
     "chanceFraction": "3/20",
     "chanceDisplay": "3 in 20 (15%)",
     "pLast": 0.040961,
     "pLastFraction": "3178481/77597520",
     "displayLast": "4.10%",
     "expectedPiecesWhenComplete": 5.1825,
     "expectedDuplicatesWhenComplete": 4.1825
    },
    {
     "name": "Caramel",
     "pieces": 2,
     "chance": 0.1,
     "chanceFraction": "1/10",
     "chanceDisplay": "2 in 20 (10%)",
     "pLast": 0.10032,
     "pLastFraction": "18956/188955",
     "displayLast": "10.0%",
     "expectedPiecesWhenComplete": 3.455,
     "expectedDuplicatesWhenComplete": 2.455
    },
    {
     "name": "Sour chews",
     "pieces": 2,
     "chance": 0.1,
     "chanceFraction": "1/10",
     "chanceDisplay": "2 in 20 (10%)",
     "pLast": 0.10032,
     "pLastFraction": "18956/188955",
     "displayLast": "10.0%",
     "expectedPiecesWhenComplete": 3.455,
     "expectedDuplicatesWhenComplete": 2.455
    },
    {
     "name": "Toffee",
     "pieces": 2,
     "chance": 0.1,
     "chanceFraction": "1/10",
     "chanceDisplay": "2 in 20 (10%)",
     "pLast": 0.10032,
     "pLastFraction": "18956/188955",
     "displayLast": "10.0%",
     "expectedPiecesWhenComplete": 3.455,
     "expectedDuplicatesWhenComplete": 2.455
    },
    {
     "name": "Mints",
     "pieces": 1,
     "chance": 0.05,
     "chanceFraction": "1/20",
     "chanceDisplay": "1 in 20 (5%)",
     "pLast": 0.314559,
     "pLastFraction": "3487001/11085360",
     "displayLast": "31.5%",
     "expectedPiecesWhenComplete": 1.7275,
     "expectedDuplicatesWhenComplete": 0.7275
    },
    {
     "name": "Candy corn",
     "pieces": 1,
     "chance": 0.05,
     "chanceFraction": "1/20",
     "chanceDisplay": "1 in 20 (5%)",
     "pLast": 0.314559,
     "pLastFraction": "3487001/11085360",
     "displayLast": "31.5%",
     "expectedPiecesWhenComplete": 1.7275,
     "expectedDuplicatesWhenComplete": 0.7275
    }
   ],
   "meanHouses": 34.5503,
   "meanFraction": "44683669/1293292",
   "sd": 19.5713,
   "median": 30,
   "p10": 16,
   "p90": 60,
   "percentileEdges": {
    "median": {
     "houses": 30,
     "pWithinBefore": 0.499642,
     "pWithin": 0.524793,
     "pMoreThan": 0.475207,
     "displayWithinBefore": "49.96%",
     "displayWithin": "52.48%",
     "displayMoreThan": "47.52%"
    },
    "p90": {
     "houses": 60,
     "pWithinBefore": 0.899362,
     "pWithin": 0.904559,
     "pMoreThan": 0.095441,
     "displayWithinBefore": "89.94%",
     "displayWithin": "90.46%",
     "displayMoreThan": "9.54%"
    }
   },
   "pWithin": {
    "10": 0.008959,
    "15": 0.091251,
    "20": 0.235444,
    "25": 0.389124,
    "30": 0.524793,
    "40": 0.721028,
    "50": 0.837294,
    "60": 0.904559,
    "75": 0.956598,
    "100": 0.988106
   },
   "displayWithin": {
    "10": "0.90%",
    "15": "9.13%",
    "20": "23.5%",
    "25": "38.9%",
    "30": "52.5%",
    "40": "72.1%",
    "50": "83.7%",
    "60": "90.46%",
    "75": "95.66%",
    "100": "98.81%"
   },
   "minHouses": 8,
   "pAtMinimum": 0.000756,
   "displayAtMinimum": "0.08%",
   "oneInAtMinimum": "1 in 1,323",
   "pMoreThan50": 0.162706,
   "displayMoreThan50": "16.3%",
   "duplicatesWhenComplete": 26.5503,
   "onePieceKinds": [
    "Mints",
    "Candy corn"
   ],
   "pLastIsOnePiece": 0.629118,
   "pLastIsOnePieceFraction": "3487001/5542680",
   "displayLastIsOnePiece": "62.9%",
   "note": "Exact (inclusion-exclusion over the 2^8 subsets of kinds, BigInt). meanHouses = sum over nonempty S of (-1)^(|S|+1) * 20/c_S; pWithin[h] = P(every kind at least once within h houses) = sum_S (-1)^|S| (20 - c_S)^h / 20^h; p10/median/p90 by exact comparison. pAtMinimum = P(a full set in exactly 8 houses, all different) = 8! * prod(c_i) / 20^8. pLast = P(this kind is the last one found) = sum over subsets S of the other kinds of (-1)^|S| c_i/(c_i + c_S). expectedPiecesWhenComplete = (c_i/20) * E[T] (Wald's identity): PIECES of that kind, the first one included; expectedDuplicatesWhenComplete = that minus 1: DUPLICATES of that kind; duplicatesWhenComplete = E[T] - 8: the duplicates of ALL kinds together (every house gives one piece; 8 of them are the set). Percentiles: the smallest number of houses h with P(full set within h) >= 50% (median), >= 90% (p90), >= 10% (p10). percentileEdges gives the exact chance within h - 1 and within h on both sides of the median and the p90 (display strings with two decimals, so 49.96% never prints as 50.0%), because they can sit on a knife edge: word the median as 'about half finish within h houses' (pWithin) and the p90 as '9 nights in 10 finish within h houses', never 'half need more than h' (that share is pMoreThan, below 50%). pAtMinimum is given to 6 significant digits."
  },
  "rareKinds": {
   "firstRare": {
    "kind": "Candy corn",
    "kinds": [
     "Candy corn"
    ],
    "meanHouses": 20,
    "meanFraction": "20/1",
    "sd": 19.4936,
    "median": 14,
    "p90": 45,
    "pWithin": {
     "10": 0.401263,
     "15": 0.536709,
     "20": 0.641514,
     "25": 0.72261,
     "30": 0.785361,
     "40": 0.871488,
     "50": 0.923055,
     "60": 0.95393,
     "75": 0.978656,
     "100": 0.994079
    }
   },
   "allOnePiece": {
    "kinds": [
     "Mints",
     "Candy corn"
    ],
    "meanHouses": 30,
    "meanFraction": "30/1",
    "sd": 21.6795,
    "median": 25,
    "p90": 58,
    "pWithin": {
     "10": 0.151205,
     "15": 0.279309,
     "20": 0.404605,
     "25": 0.517011,
     "30": 0.613114,
     "40": 0.757757,
     "50": 0.851264,
     "60": 0.909657,
     "75": 0.957683,
     "100": 0.988186
    }
   },
   "allOtherKinds": {
    "kinds": [
     "Chocolate bar",
     "Lollipop",
     "Gummy bears",
     "Caramel",
     "Sour chews",
     "Toffee"
    ],
    "meanHouses": 19.9184,
    "meanFraction": "717779/36036",
    "sd": 10.1524,
    "median": 17,
    "p90": 33,
    "pWithin": {
     "10": 0.130861,
     "15": 0.401623,
     "20": 0.627588,
     "25": 0.776776,
     "30": 0.868076,
     "40": 0.954442,
     "50": 0.984273,
     "60": 0.994554,
     "75": 0.998885,
     "100": 0.99992
    }
   },
   "fullSet": {
    "meanHouses": 34.5503,
    "median": 30,
    "p90": 60
   },
   "shareOfWaitFromOnePiece": 0.8683,
   "note": "Exact. firstRare: houses until the first piece of the rarest favorite (geometric, chance 1/20: average 20). allOnePiece: houses until both one-piece kinds have appeared (inclusion-exclusion over the two). allOtherKinds: houses until the six kinds with 2 or more pieces have all appeared. fullSet: all 8. shareOfWaitFromOnePiece = allOnePiece.meanHouses / fullSet.meanHouses: the one-piece kinds alone account for that share of the average wait."
  },
  "movedPiece": {
   "from": "Chocolate bar",
   "to": "Candy corn",
   "kinds": [
    {
     "name": "Chocolate bar",
     "pieces": 4
    },
    {
     "name": "Lollipop",
     "pieces": 4
    },
    {
     "name": "Gummy bears",
     "pieces": 3
    },
    {
     "name": "Caramel",
     "pieces": 2
    },
    {
     "name": "Sour chews",
     "pieces": 2
    },
    {
     "name": "Toffee",
     "pieces": 2
    },
    {
     "name": "Mints",
     "pieces": 1
    },
    {
     "name": "Candy corn",
     "pieces": 2
    }
   ],
   "meanHouses": 29.6401,
   "meanFraction": "344999449/11639628",
   "sd": 16.5894,
   "median": 25,
   "p10": 14,
   "p90": 50,
   "percentileEdges": {
    "median": {
     "houses": 25,
     "pWithinBefore": 0.472972,
     "pWithin": 0.505751,
     "pMoreThan": 0.494249,
     "displayWithinBefore": "47.30%",
     "displayWithin": "50.58%",
     "displayMoreThan": "49.42%"
    },
    "p90": {
     "houses": 50,
     "pWithinBefore": 0.897233,
     "pWithin": 0.903399,
     "pMoreThan": 0.096601,
     "displayWithinBefore": "89.72%",
     "displayWithin": "90.34%",
     "displayMoreThan": "9.66%"
    }
   },
   "pWithin": {
    "10": 0.014266,
    "15": 0.13685,
    "20": 0.32751,
    "25": 0.505751,
    "30": 0.644858,
    "40": 0.817536,
    "50": 0.903399,
    "60": 0.946925,
    "75": 0.977192,
    "100": 0.993973
   },
   "displayWithin": {
    "10": "1.43%",
    "15": "13.7%",
    "20": "32.8%",
    "25": "50.6%",
    "30": "64.5%",
    "40": "81.8%",
    "50": "90.34%",
    "60": "94.69%",
    "75": "97.72%",
    "100": "99.40%"
   },
   "minHouses": 8,
   "pAtMinimum": 0.0012096,
   "displayAtMinimum": "0.12%",
   "oneInAtMinimum": "1 in 827",
   "pMoreThan50": 0.096601,
   "displayMoreThan50": "9.66%",
   "duplicatesWhenComplete": 21.6401,
   "changeInMean": -4.9103,
   "note": "Exact, as for the candy bag. One 'Chocolate bar' line becomes 'Candy corn': the bag still has 20 pieces and 8 kinds. Percentiles: the smallest number of houses h with P(full set within h) >= 50% (median), >= 90% (p90), >= 10% (p10). percentileEdges gives the exact chance within h - 1 and within h on both sides of the median and the p90 (display strings with two decimals, so 49.96% never prints as 50.0%), because they can sit on a knife edge: word the median as 'about half finish within h houses' (pWithin) and the p90 as '9 nights in 10 finish within h houses', never 'half need more than h' (that share is pMoreThan, below 50%). pAtMinimum is given to 6 significant digits."
  },
  "favorites": {
   "common": {
    "kind": "Chocolate bar",
    "pieces": 5,
    "byCount": [
     {
      "pieces": 1,
      "chance": 0.25,
      "chanceFraction": "5/20",
      "meanHouses": 4,
      "meanFraction": "4/1",
      "sd": 3.4641,
      "median": 3,
      "p90": 9,
      "percentileEdges": {
       "median": {
        "houses": 3,
        "pWithinBefore": 0.4375,
        "pWithin": 0.578125,
        "pMoreThan": 0.421875,
        "displayWithinBefore": "43.75%",
        "displayWithin": "57.81%",
        "displayMoreThan": "42.19%"
       },
       "p90": {
        "houses": 9,
        "pWithinBefore": 0.899887,
        "pWithin": 0.924915,
        "pMoreThan": 0.075085,
        "displayWithinBefore": "89.99%",
        "displayWithin": "92.49%",
        "displayMoreThan": "7.51%"
       }
      },
      "pWithin": {
       "10": 0.943686,
       "15": 0.986637,
       "20": 0.996829,
       "25": 0.999247,
       "30": 0.999821,
       "40": 0.99999,
       "50": 0.999999,
       "60": 1,
       "75": 1,
       "100": 1
      },
      "displayWithin": {
       "10": "94.37%",
       "15": "98.66%",
       "20": "99.68%",
       "25": "99.92%",
       "30": "99.98%",
       "40": ">99.99%",
       "50": ">99.99%",
       "60": ">99.99%",
       "75": ">99.99%",
       "100": ">99.99%"
      }
     },
     {
      "pieces": 3,
      "chance": 0.25,
      "chanceFraction": "5/20",
      "meanHouses": 12,
      "meanFraction": "12/1",
      "sd": 6,
      "median": 11,
      "p90": 20,
      "percentileEdges": {
       "median": {
        "houses": 11,
        "pWithinBefore": 0.474407,
        "pWithin": 0.544799,
        "pMoreThan": 0.455201,
        "displayWithinBefore": "47.44%",
        "displayWithin": "54.48%",
        "displayMoreThan": "45.52%"
       },
       "p90": {
        "houses": 20,
        "pWithinBefore": 0.888655,
        "pWithin": 0.90874,
        "pMoreThan": 0.09126,
        "displayWithinBefore": "88.87%",
        "displayWithin": "90.87%",
        "displayMoreThan": "9.13%"
       }
      },
      "pWithin": {
       "10": 0.474407,
       "15": 0.763912,
       "20": 0.90874,
       "25": 0.967891,
       "30": 0.989404,
       "40": 0.998984,
       "50": 0.999913,
       "60": 0.999993,
       "75": 1,
       "100": 1
      },
      "displayWithin": {
       "10": "47.4%",
       "15": "76.4%",
       "20": "90.87%",
       "25": "96.79%",
       "30": "98.94%",
       "40": "99.90%",
       "50": ">99.99%",
       "60": ">99.99%",
       "75": ">99.99%",
       "100": ">99.99%"
      }
     }
    ]
   },
   "rare": {
    "kind": "Candy corn",
    "pieces": 1,
    "byCount": [
     {
      "pieces": 1,
      "chance": 0.05,
      "chanceFraction": "1/20",
      "meanHouses": 20,
      "meanFraction": "20/1",
      "sd": 19.4936,
      "median": 14,
      "p90": 45,
      "percentileEdges": {
       "median": {
        "houses": 14,
        "pWithinBefore": 0.486658,
        "pWithin": 0.512325,
        "pMoreThan": 0.487675,
        "displayWithinBefore": "48.67%",
        "displayWithin": "51.23%",
        "displayMoreThan": "48.77%"
       },
       "p90": {
        "houses": 45,
        "pWithinBefore": 0.895326,
        "pWithin": 0.90056,
        "pMoreThan": 0.09944,
        "displayWithinBefore": "89.53%",
        "displayWithin": "90.06%",
        "displayMoreThan": "9.94%"
       }
      },
      "pWithin": {
       "10": 0.401263,
       "15": 0.536709,
       "20": 0.641514,
       "25": 0.72261,
       "30": 0.785361,
       "40": 0.871488,
       "50": 0.923055,
       "60": 0.95393,
       "75": 0.978656,
       "100": 0.994079
      },
      "displayWithin": {
       "10": "40.1%",
       "15": "53.7%",
       "20": "64.2%",
       "25": "72.3%",
       "30": "78.5%",
       "40": "87.1%",
       "50": "92.31%",
       "60": "95.39%",
       "75": "97.87%",
       "100": "99.41%"
      }
     },
     {
      "pieces": 3,
      "chance": 0.05,
      "chanceFraction": "1/20",
      "meanHouses": 60,
      "meanFraction": "60/1",
      "sd": 33.7639,
      "median": 54,
      "p90": 105,
      "percentileEdges": {
       "median": {
        "houses": 54,
        "pWithinBefore": 0.498184,
        "pWithin": 0.510775,
        "pMoreThan": 0.489225,
        "displayWithinBefore": "49.82%",
        "displayWithin": "51.08%",
        "displayMoreThan": "48.92%"
       },
       "p90": {
        "houses": 105,
        "pWithinBefore": 0.897235,
        "pWithin": 0.900813,
        "pMoreThan": 0.099187,
        "displayWithinBefore": "89.72%",
        "displayWithin": "90.08%",
        "displayMoreThan": "9.92%"
       }
      },
      "pWithin": {
       "10": 0.011504,
       "15": 0.0362,
       "20": 0.075484,
       "25": 0.127106,
       "30": 0.187821,
       "40": 0.323264,
       "50": 0.459467,
       "60": 0.582564,
       "75": 0.730336,
       "100": 0.881737
      },
      "displayWithin": {
       "10": "1.15%",
       "15": "3.62%",
       "20": "7.55%",
       "25": "12.7%",
       "30": "18.8%",
       "40": "32.3%",
       "50": "45.9%",
       "60": "58.3%",
       "75": "73.0%",
       "100": "88.2%"
      }
     }
    ]
   },
   "note": "Exact. Houses until at least r pieces of one kind with chance p: negative binomial, average r/p houses, SD sqrt(r(1-p))/p; pWithin[h] = P(Binomial(h, p) >= r); median and p90 by exact BigInt comparison; percentileEdges as in theory.candyBag (read pWithinBefore before rounding a percentile into words: it can be a hair below 50% or 90%)."
  },
  "pooling": {
   "rows": [
    {
     "kids": 1,
     "aloneEach": {
      "meanHouses": 34.5503,
      "median": 30,
      "p90": 60,
      "pWithin": {
       "10": 0.008959,
       "15": 0.091251,
       "20": 0.235444,
       "25": 0.389124,
       "30": 0.524793,
       "40": 0.721028,
       "50": 0.837294,
       "60": 0.904559,
       "75": 0.956598,
       "100": 0.988106
      }
     },
     "aloneAll": {
      "meanHouses": 34.5503,
      "meanFraction": "44683669/1293292",
      "sd": 19.5713,
      "median": 30,
      "p90": 60,
      "pWithin": {
       "10": 0.008959,
       "15": 0.091251,
       "20": 0.235444,
       "25": 0.389124,
       "30": 0.524793,
       "40": 0.721028,
       "50": 0.837294,
       "60": 0.904559,
       "75": 0.956598,
       "100": 0.988106
      },
      "displayWithin": {
       "10": "0.90%",
       "15": "9.13%",
       "20": "23.5%",
       "25": "38.9%",
       "30": "52.5%",
       "40": "72.1%",
       "50": "83.7%",
       "60": "90.46%",
       "75": "95.66%",
       "100": "98.81%"
      }
     },
     "pooledOneSet": {
      "meanHouses": 34.5503,
      "meanFraction": "44683669/1293292",
      "sd": 19.5713,
      "median": 30,
      "p90": 60,
      "pWithin": {
       "10": 0.008959,
       "15": 0.091251,
       "20": 0.235444,
       "25": 0.389124,
       "30": 0.524793,
       "40": 0.721028,
       "50": 0.837294,
       "60": 0.904559,
       "75": 0.956598,
       "100": 0.988106
      },
      "displayWithin": {
       "10": "0.90%",
       "15": "9.13%",
       "20": "23.5%",
       "25": "38.9%",
       "30": "52.5%",
       "40": "72.1%",
       "50": "83.7%",
       "60": "90.46%",
       "75": "95.66%",
       "100": "98.81%"
      }
     },
     "pooledSetEach": {
      "meanHouses": 34.5503,
      "sd": 19.5713,
      "median": 30,
      "p90": 60,
      "pWithin": {
       "10": 0.008959,
       "15": 0.091251,
       "20": 0.235444,
       "25": 0.389124,
       "30": 0.524793,
       "40": 0.721028,
       "50": 0.837294,
       "60": 0.904559,
       "75": 0.956598,
       "100": 0.988106
      },
      "displayWithin": {
       "10": "0.90%",
       "15": "9.13%",
       "20": "23.5%",
       "25": "38.9%",
       "30": "52.5%",
       "40": "72.1%",
       "50": "83.7%",
       "60": "90.46%",
       "75": "95.66%",
       "100": "98.81%"
      },
      "meanSpins": 34.5503,
      "truncatedAtHouse": 520,
      "truncationBound": 9.91e-11,
      "extraPiecesWhenDone": 26.5503
     },
     "savingVsAloneAll": 0
    },
    {
     "kids": 2,
     "aloneEach": {
      "meanHouses": 34.5503,
      "median": 30,
      "p90": 60,
      "pWithin": {
       "10": 0.008959,
       "15": 0.091251,
       "20": 0.235444,
       "25": 0.389124,
       "30": 0.524793,
       "40": 0.721028,
       "50": 0.837294,
       "60": 0.904559,
       "75": 0.956598,
       "100": 0.988106
      }
     },
     "aloneAll": {
      "meanHouses": 44.5404,
      "meanFraction": null,
      "sd": 21.3577,
      "median": 40,
      "p90": 72,
      "pWithin": {
       "10": 0.00008026,
       "15": 0.008327,
       "20": 0.055434,
       "25": 0.151418,
       "30": 0.275408,
       "40": 0.519882,
       "50": 0.701061,
       "60": 0.818227,
       "75": 0.91508,
       "100": 0.976354
      },
      "displayWithin": {
       "10": "<0.01%",
       "15": "0.83%",
       "20": "5.54%",
       "25": "15.1%",
       "30": "27.5%",
       "40": "52.0%",
       "50": "70.1%",
       "60": "81.8%",
       "75": "91.51%",
       "100": "97.64%"
      }
     },
     "pooledOneSet": {
      "meanHouses": 17.5252,
      "meanFraction": "2340892334993711/133573286426580",
      "sd": 9.7888,
      "median": 15,
      "p90": 30,
      "pWithin": {
       "10": 0.235444,
       "15": 0.524793,
       "20": 0.721028,
       "25": 0.837294,
       "30": 0.904559,
       "40": 0.966544,
       "50": 0.988106,
       "60": 0.995749,
       "75": 0.999089,
       "100": 0.99993
      },
      "displayWithin": {
       "10": "23.5%",
       "15": "52.5%",
       "20": "72.1%",
       "25": "83.7%",
       "30": "90.46%",
       "40": "96.65%",
       "50": "98.81%",
       "60": "99.57%",
       "75": "99.91%",
       "100": ">99.99%"
      }
     },
     "pooledSetEach": {
      "meanHouses": 29.6976,
      "sd": 13.0675,
      "median": 27,
      "p90": 47,
      "pWithin": {
       "10": 0.002617,
       "15": 0.076495,
       "20": 0.255355,
       "25": 0.454575,
       "30": 0.620465,
       "40": 0.828584,
       "50": 0.92605,
       "60": 0.968998,
       "75": 0.991901,
       "100": 0.999192
      },
      "displayWithin": {
       "10": "0.26%",
       "15": "7.65%",
       "20": "25.5%",
       "25": "45.5%",
       "30": "62.0%",
       "40": "82.9%",
       "50": "92.60%",
       "60": "96.90%",
       "75": "99.19%",
       "100": "99.92%"
      },
      "meanSpins": 58.8952,
      "truncatedAtHouse": 287,
      "truncationBound": 9.77e-11,
      "extraPiecesWhenDone": 43.3952
     },
     "savingVsAloneAll": 14.8428
    },
    {
     "kids": 3,
     "aloneEach": {
      "meanHouses": 34.5503,
      "median": 30,
      "p90": 60,
      "pWithin": {
       "10": 0.008959,
       "15": 0.091251,
       "20": 0.235444,
       "25": 0.389124,
       "30": 0.524793,
       "40": 0.721028,
       "50": 0.837294,
       "60": 0.904559,
       "75": 0.956598,
       "100": 0.988106
      }
     },
     "aloneAll": {
      "meanHouses": 50.9381,
      "meanFraction": null,
      "sd": 22.1971,
      "median": 46,
      "p90": 80,
      "pWithin": {
       "10": 7.19e-7,
       "15": 0.00076,
       "20": 0.013052,
       "25": 0.05892,
       "30": 0.144532,
       "40": 0.374849,
       "50": 0.586994,
       "60": 0.740134,
       "75": 0.875364,
       "100": 0.964741
      },
      "displayWithin": {
       "10": "<0.01%",
       "15": "0.08%",
       "20": "1.31%",
       "25": "5.89%",
       "30": "14.5%",
       "40": "37.5%",
       "50": "58.7%",
       "60": "74.0%",
       "75": "87.5%",
       "100": "96.47%"
      }
     },
     "pooledOneSet": {
      "meanHouses": 11.8501,
      "meanFraction": "107621262221991723773023808381/9081905165987617330651656372",
      "sd": 6.5295,
      "median": 10,
      "p90": 20,
      "pWithin": {
       "10": 0.524793,
       "15": 0.787033,
       "20": 0.904559,
       "25": 0.956598,
       "30": 0.980073,
       "40": 0.995749,
       "50": 0.999089,
       "60": 0.999804,
       "75": 0.999981,
       "100": 1
      },
      "displayWithin": {
       "10": "52.5%",
       "15": "78.7%",
       "20": "90.46%",
       "25": "95.66%",
       "30": "98.01%",
       "40": "99.57%",
       "50": "99.91%",
       "60": "99.98%",
       "75": ">99.99%",
       "100": ">99.99%"
      }
     },
     "pooledSetEach": {
      "meanHouses": 27.652,
      "sd": 10.4633,
      "median": 26,
      "p90": 42,
      "pWithin": {
       "10": 0.001122,
       "15": 0.068199,
       "20": 0.269565,
       "25": 0.49895,
       "30": 0.681527,
       "40": 0.886849,
       "50": 0.963887,
       "60": 0.989242,
       "75": 0.998393,
       "100": 0.999941
      },
      "displayWithin": {
       "10": "0.11%",
       "15": "6.82%",
       "20": "27.0%",
       "25": "49.9%",
       "30": "68.2%",
       "40": "88.7%",
       "50": "96.39%",
       "60": "98.92%",
       "75": "99.84%",
       "100": ">99.99%"
      },
      "meanSpins": 81.956,
      "truncatedAtHouse": 208,
      "truncationBound": 9.24e-11,
      "extraPiecesWhenDone": 58.956
     },
     "savingVsAloneAll": 23.2861
    },
    {
     "kids": 4,
     "aloneEach": {
      "meanHouses": 34.5503,
      "median": 30,
      "p90": 60,
      "pWithin": {
       "10": 0.008959,
       "15": 0.091251,
       "20": 0.235444,
       "25": 0.389124,
       "30": 0.524793,
       "40": 0.721028,
       "50": 0.837294,
       "60": 0.904559,
       "75": 0.956598,
       "100": 0.988106
      }
     },
     "aloneAll": {
      "meanHouses": 55.6857,
      "meanFraction": null,
      "sd": 22.7038,
      "median": 51,
      "p90": 85,
      "pWithin": {
       "10": 6.441e-9,
       "15": 0.00006934,
       "20": 0.003073,
       "25": 0.022927,
       "30": 0.07585,
       "40": 0.270277,
       "50": 0.491487,
       "60": 0.669495,
       "75": 0.837371,
       "100": 0.953267
      },
      "displayWithin": {
       "10": "<0.01%",
       "15": "<0.01%",
       "20": "0.31%",
       "25": "2.29%",
       "30": "7.58%",
       "40": "27.0%",
       "50": "49.1%",
       "60": "66.9%",
       "75": "83.7%",
       "100": "95.33%"
      }
     },
     "pooledOneSet": {
      "meanHouses": 9.0127,
      "meanFraction": null,
      "sd": 4.9007,
      "median": 8,
      "p90": 15,
      "pWithin": {
       "10": 0.721028,
       "15": 0.904559,
       "20": 0.966544,
       "25": 0.988106,
       "30": 0.995749,
       "40": 0.999454,
       "50": 0.99993,
       "60": 0.999991,
       "75": 1,
       "100": 1
      },
      "displayWithin": {
       "10": "72.1%",
       "15": "90.46%",
       "20": "96.65%",
       "25": "98.81%",
       "30": "99.57%",
       "40": "99.95%",
       "50": ">99.99%",
       "60": ">99.99%",
       "75": ">99.99%",
       "100": ">99.99%"
      }
     },
     "pooledSetEach": {
      "meanHouses": 26.4981,
      "sd": 8.9818,
      "median": 25,
      "p90": 39,
      "pWithin": {
       "10": 0.000541,
       "15": 0.061284,
       "20": 0.278164,
       "25": 0.531062,
       "30": 0.725961,
       "40": 0.923438,
       "50": 0.98196,
       "60": 0.996175,
       "75": 0.999672,
       "100": 0.999996
      },
      "displayWithin": {
       "10": "0.05%",
       "15": "6.13%",
       "20": "27.8%",
       "25": "53.1%",
       "30": "72.6%",
       "40": "92.34%",
       "50": "98.20%",
       "60": "99.62%",
       "75": "99.97%",
       "100": ">99.99%"
      },
      "meanSpins": 104.4925,
      "truncatedAtHouse": 167,
      "truncationBound": 1e-10,
      "extraPiecesWhenDone": 73.9925
     },
     "savingVsAloneAll": 29.1876
    }
   ],
   "note": "Exact. m children walk together; each house gives each child one piece (m spins; house h is every child's h-th spin). In class, a pair matches m = 2 only if each partner spins once per house; a pair sharing one wheel with one spin per house is the one-child model. Column names: see columns; never call pooledOneSet 'a set each'. aloneEach: one child's own bag (the same for every m). aloneAll: houses until EVERY child has their own full set (the largest of m independent counts; average = sum_h (1 - F(h)^m), summed exactly as geometric series). pooledOneSet: the pooled haul holds every kind at least once (houses = ceil(N/m) for the spins N one set needs; average = sum over nonempty S of (-1)^(|S|+1) 20^m/(20^m - (20 - c_S)^m)). pooledSetEach: the pooled haul holds every kind at least m times, so the children can trade until each holds a complete set (exact BigInt DP over the kinds; average = sum of P(not done after h houses) up to truncatedAtHouse, plus at most truncationBound, below 1e-10: the truncation touches only digits beyond the 10th decimal, and the 4-decimal averages agree with a closed form that has none). meanFraction: the reduced exact fraction, or null when it is longer than 60 characters (aloneAll for m >= 2, pooledOneSet for m = 4); the decimal meanHouses is exact to the digits shown either way. pooledSetEach has no meanFraction (a truncated sum). With kids = 1 all four columns are the same quantity. extraPiecesWhenDone = m * average houses - 8m: the pooled pieces beyond the m sets, on average. savingVsAloneAll = aloneAll - pooledSetEach (houses). Pooling for a set each can never take longer than every child going alone, night by night: if each child has a set, the pooled haul has m of every kind.",
   "columns": {
    "aloneEach": "one child alone: houses until that child has a full set (the same for every m)",
    "aloneAll": "every child alone until the last has a set: houses until EVERY child has their own full set, no trading",
    "pooledOneSet": "one set between them: the pooled haul holds every kind at least once (ONE set for the whole group, not a set each)",
    "pooledSetEach": "a full set each after trading: the pooled haul holds every kind at least m times"
   }
  },
  "chartFullSet": {
   "houses": [
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    16,
    17,
    18,
    19,
    20,
    21,
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    32,
    33,
    34,
    35,
    36,
    37,
    38,
    39,
    40,
    41,
    42,
    43,
    44,
    45,
    46,
    47,
    48,
    49,
    50,
    51,
    52,
    53,
    54,
    55,
    56,
    57,
    58,
    59,
    60,
    61,
    62,
    63,
    64,
    65,
    66,
    67,
    68,
    69,
    70,
    71,
    72,
    73,
    74,
    75,
    76,
    77,
    78,
    79,
    80,
    81,
    82,
    83,
    84,
    85,
    86,
    87,
    88,
    89,
    90,
    91,
    92,
    93,
    94,
    95,
    96,
    97,
    98,
    99,
    100
   ],
   "candyBag": [
    0.000756,
    0.003402,
    0.008959,
    0.018087,
    0.031053,
    0.047791,
    0.068003,
    0.091251,
    0.117031,
    0.144821,
    0.17412,
    0.204465,
    0.235444,
    0.266699,
    0.297925,
    0.328869,
    0.359324,
    0.389124,
    0.418141,
    0.446277,
    0.47346,
    0.499642,
    0.524793,
    0.5489,
    0.571959,
    0.59398,
    0.614979,
    0.634977,
    0.654003,
    0.672088,
    0.689263,
    0.705565,
    0.721028,
    0.73569,
    0.749586,
    0.762752,
    0.775223,
    0.787033,
    0.798216,
    0.808803,
    0.818826,
    0.828313,
    0.837294,
    0.845795,
    0.853842,
    0.861459,
    0.86867,
    0.875497,
    0.88196,
    0.88808,
    0.893874,
    0.899362,
    0.904559,
    0.909481,
    0.914144,
    0.918561,
    0.922746,
    0.926712,
    0.930469,
    0.93403,
    0.937405,
    0.940604,
    0.943637,
    0.946512,
    0.949238,
    0.951823,
    0.954274,
    0.956598,
    0.958803,
    0.960894,
    0.962877,
    0.964759,
    0.966544,
    0.968237,
    0.969844,
    0.971369,
    0.972815,
    0.974188,
    0.975491,
    0.976728,
    0.977902,
    0.979016,
    0.980073,
    0.981077,
    0.98203,
    0.982934,
    0.983793,
    0.984608,
    0.985382,
    0.986117,
    0.986815,
    0.987477,
    0.988106
   ],
   "evenBag": [
    0.002403,
    0.010815,
    0.028163,
    0.055763,
    0.093306,
    0.139321,
    0.191718,
    0.248248,
    0.306798,
    0.365562,
    0.423102,
    0.478348,
    0.530558,
    0.579272,
    0.62425,
    0.665422,
    0.702841,
    0.736649,
    0.767044,
    0.794257,
    0.818536,
    0.840135,
    0.859301,
    0.876274,
    0.891278,
    0.90452,
    0.916194,
    0.926474,
    0.935517,
    0.943467,
    0.950451,
    0.956582,
    0.961962,
    0.966682,
    0.97082,
    0.974448,
    0.977627,
    0.980413,
    0.982853,
    0.98499,
    0.986861,
    0.9885,
    0.989935,
    0.991191,
    0.992291,
    0.993253,
    0.994096,
    0.994833,
    0.995479,
    0.996043,
    0.996538,
    0.99697,
    0.997349,
    0.99768,
    0.99797,
    0.998224,
    0.998446,
    0.99864,
    0.99881,
    0.998959,
    0.999089,
    0.999203,
    0.999302,
    0.99939,
    0.999466,
    0.999533,
    0.999591,
    0.999642,
    0.999687,
    0.999726,
    0.99976,
    0.99979,
    0.999816,
    0.999839,
    0.999859,
    0.999877,
    0.999892,
    0.999906,
    0.999918,
    0.999928,
    0.999937,
    0.999945,
    0.999952,
    0.999958,
    0.999963,
    0.999968,
    0.999972,
    0.999975,
    0.999978,
    0.999981,
    0.999983,
    0.999985,
    0.999987
   ],
   "movedPiece": [
    0.00121,
    0.005443,
    0.014266,
    0.028565,
    0.048516,
    0.073733,
    0.103481,
    0.13685,
    0.172897,
    0.210726,
    0.249538,
    0.288652,
    0.32751,
    0.365667,
    0.402785,
    0.438612,
    0.472972,
    0.505751,
    0.536884,
    0.566346,
    0.594141,
    0.620296,
    0.644858,
    0.667882,
    0.689434,
    0.709584,
    0.728406,
    0.745974,
    0.762362,
    0.777643,
    0.791888,
    0.805164,
    0.817536,
    0.829065,
    0.839809,
    0.849824,
    0.85916,
    0.867865,
    0.875985,
    0.883561,
    0.890631,
    0.897233,
    0.903399,
    0.90916,
    0.914546,
    0.919582,
    0.924295,
    0.928706,
    0.932836,
    0.936706,
    0.940333,
    0.943734,
    0.946925,
    0.949919,
    0.952731,
    0.955372,
    0.957854,
    0.960188,
    0.962382,
    0.964447,
    0.966391,
    0.968221,
    0.969945,
    0.97157,
    0.973101,
    0.974545,
    0.975907,
    0.977192,
    0.978405,
    0.97955,
    0.980631,
    0.981652,
    0.982618,
    0.98353,
    0.984392,
    0.985207,
    0.985978,
    0.986708,
    0.987398,
    0.988051,
    0.988669,
    0.989254,
    0.989808,
    0.990333,
    0.99083,
    0.991301,
    0.991747,
    0.992169,
    0.99257,
    0.992949,
    0.993309,
    0.99365,
    0.993973
   ],
   "note": "Exact P(a full set within h houses), one child: the candy bag, the even bag (8 kinds, equal chances) and the candy bag with one piece moved. Values within 5e-7 of 1 print as 1."
  },
  "candyBagPmf": {
   "houses0": 0,
   "pmf": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0.000756,
    0.002646,
    0.005557,
    0.009129,
    0.012966,
    0.016738,
    0.020212,
    0.023249,
    0.02578,
    0.02779,
    0.029299,
    0.030345,
    0.030979,
    0.031255,
    0.031226,
    0.030944,
    0.030455,
    0.0298,
    0.029017,
    0.028135,
    0.027183,
    0.026182,
    0.025151,
    0.024106,
    0.02306,
    0.022021,
    0.020999,
    0.019999,
    0.019026,
    0.018084,
    0.017175,
    0.016302,
    0.015464,
    0.014662,
    0.013896,
    0.013166,
    0.012471,
    0.01181,
    0.011183,
    0.010587,
    0.010023,
    0.009488,
    0.008981,
    0.008501,
    0.008047,
    0.007617,
    0.007211,
    0.006827,
    0.006463,
    0.00612,
    0.005795,
    0.005488,
    0.005197,
    0.004922,
    0.004663,
    0.004417,
    0.004185,
    0.003965,
    0.003758,
    0.003561,
    0.003375,
    0.003199,
    0.003033,
    0.002875,
    0.002726,
    0.002585,
    0.002451,
    0.002324,
    0.002205,
    0.002091,
    0.001983,
    0.001882,
    0.001785,
    0.001694,
    0.001607,
    0.001525,
    0.001447,
    0.001373,
    0.001303,
    0.001237,
    0.001174,
    0.001114,
    0.001057,
    0.001004,
    0.000953,
    0.000905,
    0.000859,
    0.000815,
    0.000774,
    0.000735,
    0.000698,
    0.000662,
    0.000629,
    0.000597,
    0.000567,
    0.000539,
    0.000511,
    0.000486,
    0.000461,
    0.000438,
    0.000416,
    0.000395,
    0.000375,
    0.000356,
    0.000338,
    0.000321,
    0.000305,
    0.00029,
    0.000275,
    0.000262,
    0.000248,
    0.000236,
    0.000224,
    0.000213,
    0.000202,
    0.000192,
    0.000182,
    0.000173,
    0.000165,
    0.000156,
    0.000149,
    0.000141,
    0.000134,
    0.000127,
    0.000121,
    0.000115,
    0.000109,
    0.000104,
    0.00009846,
    0.00009353,
    0.00008885,
    0.0000844,
    0.00008018,
    0.00007616,
    0.00007235,
    0.00006873,
    0.00006529,
    0.00006202,
    0.00005892,
    0.00005597,
    0.00005317,
    0.00005051,
    0.00004798,
    0.00004558,
    0.0000433,
    0.00004114,
    0.00003908,
    0.00003712,
    0.00003527,
    0.0000335,
    0.00003183,
    0.00003023,
    0.00002872,
    0.00002729,
    0.00002592,
    0.00002462,
    0.00002339,
    0.00002222,
    0.00002111,
    0.00002006,
    0.00001905,
    0.0000181,
    0.00001719,
    0.00001633,
    0.00001552,
    0.00001474,
    0.000014,
    0.0000133,
    0.00001264,
    0.00001201,
    0.00001141,
    0.00001084,
    0.00001029,
    0.000009779,
    0.00000929,
    0.000008826,
    0.000008384,
    0.000007965,
    0.000007567,
    0.000007188,
    0.000006829,
    0.000006487,
    0.000006163,
    0.000005855,
    0.000005562,
    0.000005284,
    0.00000502,
    0.000004769,
    0.00000453,
    0.000004304,
    0.000004089,
    0.000003884,
    0.00000369,
    0.000003505,
    0.00000333,
    0.000003164,
    0.000003005,
    0.000002855,
    0.000002712,
    0.000002577,
    0.000002448,
    0.000002326,
    0.000002209,
    0.000002099,
    0.000001994,
    0.000001894,
    0.000001799,
    0.000001709,
    0.000001624,
    0.000001543,
    0.000001466,
    0.000001392,
    0.000001323,
    0.000001257,
    0.000001194,
    0.000001134,
    0.000001077,
    0.000001024,
    9.723e-7,
    9.237e-7,
    8.775e-7,
    8.337e-7,
    7.92e-7,
    7.524e-7,
    7.148e-7,
    6.79e-7,
    6.451e-7,
    6.128e-7,
    5.822e-7,
    5.531e-7,
    5.254e-7
   ],
   "note": "Exact P(the full set is completed at exactly house h), h = 0, 1, 2, ...; rounded like every probability here (6 decimals, 4 significant digits below 1e-4); trailing values below 5e-7 cut."
  },
  "chartPooling": {
   "kids": [
    1,
    2,
    3,
    4
   ],
   "aloneAll": [
    34.5503,
    44.5404,
    50.9381,
    55.6857
   ],
   "pooledOneSet": [
    34.5503,
    17.5252,
    11.8501,
    9.0127
   ],
   "pooledSetEach": [
    34.5503,
    29.6976,
    27.652,
    26.4981
   ],
   "aloneEach": [
    34.5503,
    34.5503,
    34.5503,
    34.5503
   ],
   "within30": {
    "aloneAll": [
     0.524793,
     0.275408,
     0.144532,
     0.07585
    ],
    "pooledSetEach": [
     0.524793,
     0.620465,
     0.681527,
     0.725961
    ],
    "pooledOneSet": [
     0.524793,
     0.904559,
     0.980073,
     0.995749
    ]
   },
   "note": "Exact average houses by number of children (table of going alone vs pooling), and the chance within 30 houses."
  },
  "widgetAnchors": {
   "defaults": {
    "lines": [
     "Chocolate bar 5",
     "Lollipop 4",
     "Gummy bears 3",
     "Caramel 2",
     "Sour chews 2",
     "Toffee 2",
     "Mints 1",
     "Candy corn 1"
    ],
    "kids": 1,
    "houses": 30
   },
   "wheelWeightedLines": [
    "Chocolate bar *5",
    "Lollipop *4",
    "Gummy bears *3",
    "Caramel *2",
    "Sour chews *2",
    "Toffee *2",
    "Mints *1",
    "Candy corn *1"
   ],
   "rows": [
    {
     "bag": "candy bag",
     "lines": [
      "Chocolate bar 5",
      "Lollipop 4",
      "Gummy bears 3",
      "Caramel 2",
      "Sour chews 2",
      "Toffee 2",
      "Mints 1",
      "Candy corn 1"
     ],
     "kids": 1,
     "pooledOneSetMean": 34.5503,
     "pooledSetEachMean": 34.5503,
     "pOneSetWithin": {
      "20": 0.235444,
      "30": 0.524793,
      "50": 0.837294
     },
     "pSetEachWithin": {
      "20": 0.235444,
      "30": 0.524793,
      "50": 0.837294
     }
    },
    {
     "bag": "candy bag",
     "lines": [
      "Chocolate bar 5",
      "Lollipop 4",
      "Gummy bears 3",
      "Caramel 2",
      "Sour chews 2",
      "Toffee 2",
      "Mints 1",
      "Candy corn 1"
     ],
     "kids": 2,
     "pooledOneSetMean": 17.5252,
     "pooledSetEachMean": 29.6976,
     "pOneSetWithin": {
      "20": 0.721028,
      "30": 0.904559,
      "50": 0.988106
     },
     "pSetEachWithin": {
      "20": 0.255355,
      "30": 0.620465,
      "50": 0.92605
     }
    },
    {
     "bag": "candy bag",
     "lines": [
      "Chocolate bar 5",
      "Lollipop 4",
      "Gummy bears 3",
      "Caramel 2",
      "Sour chews 2",
      "Toffee 2",
      "Mints 1",
      "Candy corn 1"
     ],
     "kids": 3,
     "pooledOneSetMean": 11.8501,
     "pooledSetEachMean": 27.652,
     "pOneSetWithin": {
      "20": 0.904559,
      "30": 0.980073,
      "50": 0.999089
     },
     "pSetEachWithin": {
      "20": 0.269565,
      "30": 0.681527,
      "50": 0.963887
     }
    },
    {
     "bag": "candy bag",
     "lines": [
      "Chocolate bar 5",
      "Lollipop 4",
      "Gummy bears 3",
      "Caramel 2",
      "Sour chews 2",
      "Toffee 2",
      "Mints 1",
      "Candy corn 1"
     ],
     "kids": 4,
     "pooledOneSetMean": 9.0127,
     "pooledSetEachMean": 26.4981,
     "pOneSetWithin": {
      "20": 0.966544,
      "30": 0.995749,
      "50": 0.99993
     },
     "pSetEachWithin": {
      "20": 0.278164,
      "30": 0.725961,
      "50": 0.98196
     }
    },
    {
     "bag": "even bag",
     "lines": [
      "Chocolate bar 1",
      "Lollipop 1",
      "Gummy bears 1",
      "Caramel 1",
      "Sour chews 1",
      "Toffee 1",
      "Mints 1",
      "Candy corn 1"
     ],
     "kids": 1,
     "pooledOneSetMean": 21.7429,
     "pooledSetEachMean": 21.7429,
     "pOneSetWithin": {
      "20": 0.530558,
      "30": 0.859301,
      "50": 0.989935
     },
     "pSetEachWithin": {
      "20": 0.530558,
      "30": 0.859301,
      "50": 0.989935
     }
    },
    {
     "bag": "even bag",
     "lines": [
      "Chocolate bar 1",
      "Lollipop 1",
      "Gummy bears 1",
      "Caramel 1",
      "Sour chews 1",
      "Toffee 1",
      "Mints 1",
      "Candy corn 1"
     ],
     "kids": 2,
     "pooledOneSetMean": 11.1214,
     "pooledSetEachMean": 17.6923,
     "pOneSetWithin": {
      "20": 0.961962,
      "30": 0.997349,
      "50": 0.999987
     },
     "pSetEachWithin": {
      "20": 0.758692,
      "30": 0.974723,
      "50": 0.999806
     }
    },
    {
     "bag": "even bag",
     "lines": [
      "Chocolate bar 1",
      "Lollipop 1",
      "Gummy bears 1",
      "Caramel 1",
      "Sour chews 1",
      "Toffee 1",
      "Mints 1",
      "Candy corn 1"
     ],
     "kids": 3,
     "pooledOneSetMean": 7.5808,
     "pooledSetEachMean": 15.8969,
     "pOneSetWithin": {
      "20": 0.997349,
      "30": 0.999952,
      "50": 1
     },
     "pSetEachWithin": {
      "20": 0.881863,
      "30": 0.995387,
      "50": 0.999996
     }
    },
    {
     "bag": "even bag",
     "lines": [
      "Chocolate bar 1",
      "Lollipop 1",
      "Gummy bears 1",
      "Caramel 1",
      "Sour chews 1",
      "Toffee 1",
      "Mints 1",
      "Candy corn 1"
     ],
     "kids": 4,
     "pooledOneSetMean": 5.8109,
     "pooledSetEachMean": 14.8379,
     "pOneSetWithin": {
      "20": 0.999816,
      "30": 0.999999,
      "50": 1
     },
     "pSetEachWithin": {
      "20": 0.942515,
      "30": 0.999136,
      "50": 1
     }
    },
    {
     "bag": "moved piece",
     "lines": [
      "Chocolate bar 4",
      "Lollipop 4",
      "Gummy bears 3",
      "Caramel 2",
      "Sour chews 2",
      "Toffee 2",
      "Mints 1",
      "Candy corn 2"
     ],
     "kids": 1,
     "pooledOneSetMean": 29.6401,
     "pooledSetEachMean": 29.6401,
     "pOneSetWithin": {
      "20": 0.32751,
      "30": 0.644858,
      "50": 0.903399
     },
     "pSetEachWithin": {
      "20": 0.32751,
      "30": 0.644858,
      "50": 0.903399
     }
    },
    {
     "bag": "moved piece",
     "lines": [
      "Chocolate bar 4",
      "Lollipop 4",
      "Gummy bears 3",
      "Caramel 2",
      "Sour chews 2",
      "Toffee 2",
      "Mints 1",
      "Candy corn 2"
     ],
     "kids": 2,
     "pooledOneSetMean": 15.07,
     "pooledSetEachMean": 25.3516,
     "pOneSetWithin": {
      "20": 0.817536,
      "30": 0.946925,
      "50": 0.993973
     },
     "pSetEachWithin": {
      "20": 0.403153,
      "30": 0.761706,
      "50": 0.961661
     }
    },
    {
     "bag": "moved piece",
     "lines": [
      "Chocolate bar 4",
      "Lollipop 4",
      "Gummy bears 3",
      "Caramel 2",
      "Sour chews 2",
      "Toffee 2",
      "Mints 1",
      "Candy corn 2"
     ],
     "kids": 3,
     "pooledOneSetMean": 10.2133,
     "pooledSetEachMean": 23.6013,
     "pOneSetWithin": {
      "20": 0.946925,
      "30": 0.989808,
      "50": 0.999544
     },
     "pSetEachWithin": {
      "20": 0.452989,
      "30": 0.817471,
      "50": 0.981762
     }
    },
    {
     "bag": "moved piece",
     "lines": [
      "Chocolate bar 4",
      "Lollipop 4",
      "Gummy bears 3",
      "Caramel 2",
      "Sour chews 2",
      "Toffee 2",
      "Mints 1",
      "Candy corn 2"
     ],
     "kids": 4,
     "pooledOneSetMean": 7.7851,
     "pooledSetEachMean": 22.6543,
     "pOneSetWithin": {
      "20": 0.982618,
      "30": 0.997865,
      "50": 0.999965
     },
     "pSetEachWithin": {
      "20": 0.485098,
      "30": 0.849949,
      "50": 0.990946
     }
    }
   ],
   "note": "Exact anchors for the widget (kinds with counts, one per line, e.g. 'Chocolate bar 5' = 5 of the 20 slices). That 'Name 5' format is for the widget's calculator ONLY: pasted into the wheel, 'Chocolate bar 5' is one slice literally named 'Chocolate bar 5' with weight 1, whether Weighted choices is on or off (app.js parseEntries reads a weight only from '*5', or 'x5' after a space, and only with Weighted choices on). The same bag on the wheel is either one line per piece (the Candy bag (math) list as it is) or wheelWeightedLines ('Chocolate bar *5', ...) with Weighted choices turned on. The article and the widget must say so; the widget may also accept '*5' and ' x5'. kids = children pooling; with kids = 1 both columns are one child's full set. pooledOneSetMean: exact fraction as in theory.pooling; pooledSetEachMean: the exact BigInt DP (every kind at least kids times), cross-checked by the Poissonization integral; pOneSetWithin / pSetEachWithin: exact chance within h houses (kids pieces per house). The candy-bag rows repeat theory.pooling."
  },
  "methodChecks": [
   {
    "name": "candy bag: mean houses from the exact fraction vs the summed CDF",
    "valueA": 34.55033279414084,
    "valueB": 34.55033279414014,
    "absDiff": 7.03e-13,
    "tolerance": 1e-9,
    "pass": true
   },
   {
    "name": "even bag: mean houses vs 8 * H_8 (harmonic number)",
    "valueA": 21.742857142857144,
    "valueB": 21.74285714285714,
    "absDiff": 3.55e-15,
    "tolerance": 1e-12,
    "pass": true
   },
   {
    "name": "DP with m = 1 equals the inclusion-exclusion counts for every n = 0..520 (BigInt equality)",
    "pass": true
   },
   {
    "name": "m = 1: P(every kind at least 1 times within n spins), BigInt DP vs double-precision conditional-binomial DP, largest difference over n = 0..520",
    "valueA": 4.735656311538605e-12,
    "valueB": 0,
    "absDiff": 4.74e-12,
    "tolerance": 1e-10,
    "pass": true
   },
   {
    "name": "m = 2: P(every kind at least 2 times within n spins), BigInt DP vs double-precision conditional-binomial DP, largest difference over n = 0..574",
    "valueA": 4.7514214784882824e-12,
    "valueB": 0,
    "absDiff": 4.75e-12,
    "tolerance": 1e-10,
    "pass": true
   },
   {
    "name": "m = 3: P(every kind at least 3 times within n spins), BigInt DP vs double-precision conditional-binomial DP, largest difference over n = 0..624",
    "valueA": 4.751088411580895e-12,
    "valueB": 0,
    "absDiff": 4.75e-12,
    "tolerance": 1e-10,
    "pass": true
   },
   {
    "name": "m = 4: P(every kind at least 4 times within n spins), BigInt DP vs double-precision conditional-binomial DP, largest difference over n = 0..668",
    "valueA": 4.75175454539567e-12,
    "valueB": 0,
    "absDiff": 4.75e-12,
    "tolerance": 1e-10,
    "pass": true
   },
   {
    "name": "m = 1: average spins for every kind at least 1 times, DP sum vs Poissonization integral",
    "valueA": 34.55033279404176,
    "valueB": 34.55033279414069,
    "absDiff": 9.89e-11,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "m = 1: average houses for one pooled set, exact fraction vs summed CDF",
    "valueA": 34.55033279414084,
    "valueB": 34.55033279132436,
    "absDiff": 2.82e-9,
    "tolerance": 1e-8,
    "pass": true
   },
   {
    "name": "m = 1: average houses until every child alone has a set, exact fraction vs summed CDF",
    "valueA": 34.55033279414084,
    "valueB": 34.55033279414014,
    "absDiff": 7.03e-13,
    "tolerance": 1e-8,
    "pass": true
   },
   {
    "name": "m = 2: average spins for every kind at least 2 times, DP sum vs Poissonization integral",
    "valueA": 58.89517850756189,
    "valueB": 58.89517850776217,
    "absDiff": 2e-10,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "m = 2: average houses for one pooled set, exact fraction vs summed CDF",
    "valueA": 17.52515340169015,
    "valueB": 17.52515340159299,
    "absDiff": 9.72e-11,
    "tolerance": 1e-8,
    "pass": true
   },
   {
    "name": "m = 2: average houses until every child alone has a set, exact fraction vs summed CDF",
    "valueA": 44.54040428940292,
    "valueB": 44.54040428940151,
    "absDiff": 1.41e-12,
    "tolerance": 1e-8,
    "pass": true
   },
   {
    "name": "m = 3: average spins for every kind at least 3 times, DP sum vs Poissonization integral",
    "valueA": 81.95600329107222,
    "valueB": 81.95600329136312,
    "absDiff": 2.91e-10,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "m = 3: average houses for one pooled set, exact fraction vs summed CDF",
    "valueA": 11.850075535366855,
    "valueB": 11.85007553536144,
    "absDiff": 5.41e-12,
    "tolerance": 1e-8,
    "pass": true
   },
   {
    "name": "m = 3: average houses until every child alone has a set, exact fraction vs summed CDF",
    "valueA": 50.93809980370569,
    "valueB": 50.938099803703565,
    "absDiff": 2.12e-12,
    "tolerance": 1e-8,
    "pass": true
   },
   {
    "name": "m = 4: average spins for every kind at least 4 times, DP sum vs Poissonization integral",
    "valueA": 104.49251977039243,
    "valueB": 104.49251977082199,
    "absDiff": 4.3e-10,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "m = 4: average houses for one pooled set, exact fraction vs summed CDF",
    "valueA": 9.012656808473176,
    "valueB": 9.01265680847272,
    "absDiff": 4.57e-13,
    "tolerance": 1e-8,
    "pass": true
   },
   {
    "name": "m = 4: average houses until every child alone has a set, exact fraction vs summed CDF",
    "valueA": 55.68570564139392,
    "valueB": 55.685705641391095,
    "absDiff": 2.83e-12,
    "tolerance": 1e-8,
    "pass": true
   },
   {
    "name": "even bag, m = 1: average spins for every kind at least 1 times, DP sum vs Poissonization integral",
    "valueA": 21.74285714276255,
    "valueB": 21.74285714285714,
    "absDiff": 9.46e-11,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "even bag, m = 2: average spins for every kind at least 2 times, DP sum vs Poissonization integral",
    "valueA": 34.88468682304256,
    "valueB": 34.884686823238106,
    "absDiff": 1.96e-10,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "even bag, m = 3: average spins for every kind at least 3 times, DP sum vs Poissonization integral",
    "valueA": 46.69068449057284,
    "valueB": 46.69068449087989,
    "absDiff": 3.07e-10,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "even bag, m = 4: average spins for every kind at least 4 times, DP sum vs Poissonization integral",
    "valueA": 57.85174682787555,
    "valueB": 57.85174682834549,
    "absDiff": 4.7e-10,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "moved piece, m = 1: average spins for every kind at least 1 times, DP sum vs Poissonization integral",
    "valueA": 29.64007518100036,
    "valueB": 29.64007518109676,
    "absDiff": 9.64e-11,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "moved piece, m = 2: average spins for every kind at least 2 times, DP sum vs Poissonization integral",
    "valueA": 50.20314695934695,
    "valueB": 50.203146959547766,
    "absDiff": 2.01e-10,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "moved piece, m = 3: average spins for every kind at least 3 times, DP sum vs Poissonization integral",
    "valueA": 69.80377396940362,
    "valueB": 69.80377396970354,
    "absDiff": 3e-10,
    "tolerance": 0.000001,
    "pass": true
   },
   {
    "name": "moved piece, m = 4: average spins for every kind at least 4 times, DP sum vs Poissonization integral",
    "valueA": 89.1173884543647,
    "valueB": 89.11738845474214,
    "absDiff": 3.77e-10,
    "tolerance": 0.000001,
    "pass": true
   }
  ]
 },
 "results": {
  "candyBag": {
   "nights": 400000,
   "meanHouses": 34.5537,
   "seMean": 0.031,
   "pWithin": {
    "10": 0.008887,
    "15": 0.091605,
    "20": 0.23579,
    "25": 0.38972,
    "30": 0.524578,
    "40": 0.720975,
    "50": 0.837228,
    "60": 0.904258,
    "75": 0.956285,
    "100": 0.988265
   },
   "pAtMinimum": 0.000758,
   "pLastIsOnePiece": 0.629202,
   "pLastByKind": [
    0.00971,
    0.019777,
    0.040578,
    0.100322,
    0.099903,
    0.100507,
    0.314995,
    0.314207
   ],
   "expectedPiecesWhenComplete": [
    8.6401,
    6.9085,
    5.1819,
    3.4523,
    3.4574,
    3.4579,
    1.7302,
    1.7254
   ],
   "duplicatesWhenComplete": 26.5537,
   "firstRareMean": 20.0067,
   "allOnePieceMean": 29.9885,
   "allOtherKindsMean": 19.9103,
   "favorites": {
    "commonFirst": 3.9962,
    "commonThird": 11.9952,
    "rareFirst": 20.0067,
    "rareThird": 60.0119,
    "pRareThreeWithin30": 0.187715,
    "pCommonThreeWithin10": 0.474865
   },
   "pmf": [
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0.000758,
    0.00265,
    0.00548,
    0.009272,
    0.013048,
    0.016405,
    0.020502,
    0.02349,
    0.025947,
    0.027835,
    0.029355,
    0.030225,
    0.030822,
    0.03117,
    0.031372,
    0.031095,
    0.030242,
    0.03005,
    0.02895,
    0.027705,
    0.027228,
    0.026363,
    0.024612,
    0.024345,
    0.02311,
    0.021767,
    0.021007,
    0.020268,
    0.019068,
    0.017935,
    0.01737,
    0.016352,
    0.015175,
    0.014555,
    0.013758,
    0.013165,
    0.012575,
    0.011785,
    0.011452,
    0.010705,
    0.009853,
    0.00936,
    0.009045,
    0.0084,
    0.008037,
    0.007652,
    0.00705,
    0.006925,
    0.006477,
    0.006193,
    0.005868,
    0.005322,
    0.005105,
    0.005005,
    0.00472,
    0.00429,
    0.004168,
    0.004025,
    0.003795,
    0.003458,
    0.003357,
    0.003172,
    0.00312,
    0.002907,
    0.0028,
    0.0025,
    0.002425,
    0.002285,
    0.002282,
    0.00209,
    0.001937,
    0.001935,
    0.001808,
    0.001682,
    0.001655,
    0.001592,
    0.001468,
    0.001257,
    0.001313,
    0.001233,
    0.001165,
    0.001155,
    0.001192,
    0.00101,
    0.000928,
    0.001075,
    0.000925,
    0.000767,
    0.00082,
    0.000682,
    0.000737,
    0.00064,
    0.00063,
    0.000585,
    0.00049,
    0.000527,
    0.00047,
    0.000535,
    0.00048,
    0.000425,
    0.000382,
    0.0004,
    0.000373,
    0.00036,
    0.000358,
    0.000273,
    0.000298,
    0.00029,
    0.000287,
    0.00021,
    0.000247,
    0.00024,
    0.000237,
    0.000218,
    0.00019,
    0.000235,
    0.000208,
    0.000168,
    0.000165,
    0.00016,
    0.00011,
    0.00015,
    0.000138,
    0.000105,
    0.000112,
    0.00009,
    0.000112,
    0.00013,
    0.000068,
    0.000082,
    0.000097,
    0.000065,
    0.00009,
    0.000085,
    0.00009,
    0.000063,
    0.00006,
    0.000065,
    0.000025,
    0.000068,
    0.000073,
    0.000053,
    0.000045,
    0.000053,
    0.00004,
    0.00003,
    0.000045,
    0.000025,
    0.000028,
    0.000035,
    0.000037,
    0.000028,
    0.000037,
    0.00004,
    0.000015,
    0.000025,
    0.000043,
    0.000017,
    0.000032,
    0.000023,
    0.000013,
    0.000023,
    0.000008,
    0.00001,
    0.000017,
    0.000015,
    0.000017,
    0.00003,
    0.000008,
    0.000015,
    0.00002,
    0.000008,
    0.00001,
    0.000005,
    0.000008,
    0.000005,
    0.000013,
    0.000015,
    0.000005,
    0.00001,
    0.000008,
    0.000003,
    0.000008,
    0.000008,
    0.000005,
    0.000003,
    0.000003,
    0.00001,
    0.000005,
    0.000005,
    0.000005,
    0.000003,
    0.000008,
    0,
    0.000005,
    0,
    0.000003,
    0.000003,
    0.000005,
    0.000003,
    0.000008,
    0.000003,
    0,
    0,
    0.000003,
    0.000005,
    0.000003,
    0,
    0,
    0.000003,
    0,
    0.000003,
    0.000003,
    0.000003,
    0.000008,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0.000003,
    0,
    0,
    0,
    0,
    0,
    0,
    0.000003,
    0.000003
   ],
   "note": "Simulated nights of one child on the Candy bag wheel; each night continues until the set is complete AND 3 pieces of each favorite have come up, so the favorite-kind waits are read from the same nights. pmf: simulated share of nights completed at exactly house h (for the chart next to theory.candyBagPmf). pLastByKind and the six-kind wait are reported with checks only for the summary values listed in checks."
  },
  "evenBag": {
   "nights": 200000,
   "meanHouses": 21.7844,
   "seMean": 0.0196,
   "pWithin": {
    "10": 0.02751,
    "15": 0.246835,
    "20": 0.52904,
    "25": 0.735455,
    "30": 0.85868,
    "40": 0.961375,
    "50": 0.989565,
    "60": 0.99714,
    "75": 0.999595,
    "100": 0.99998
   }
  },
  "movedPiece": {
   "nights": 200000,
   "meanHouses": 29.656,
   "seMean": 0.0373,
   "pWithin": {
    "10": 0.014465,
    "15": 0.13803,
    "20": 0.32821,
    "25": 0.506635,
    "30": 0.64443,
    "40": 0.81717,
    "50": 0.90282,
    "60": 0.94618,
    "75": 0.97666,
    "100": 0.99388
   }
  },
  "pooling": {
   "rows": [
    {
     "kids": 2,
     "nights": 150000,
     "aloneEachMean": 34.5229,
     "aloneAllMean": 44.4974,
     "pooledOneSetMean": 17.5353,
     "pooledSetEachMean": 29.675,
     "pAloneAllWithin30": 0.275387,
     "pPooledSetEachWithin30": 0.620767,
     "pPooledOneSetWithin30": 0.904947,
     "pPooledSetEachWithin20": 0.25626
    },
    {
     "kids": 3,
     "nights": 120000,
     "aloneEachMean": 34.5445,
     "aloneAllMean": 50.9203,
     "pooledOneSetMean": 11.8643,
     "pooledSetEachMean": 27.6283,
     "pAloneAllWithin30": 0.143833,
     "pPooledSetEachWithin30": 0.680992,
     "pPooledOneSetWithin30": 0.979908,
     "pPooledSetEachWithin20": 0.271308
    },
    {
     "kids": 4,
     "nights": 100000,
     "aloneEachMean": 34.5373,
     "aloneAllMean": 55.6015,
     "pooledOneSetMean": 9.0141,
     "pooledSetEachMean": 26.4914,
     "pAloneAllWithin30": 0.07697,
     "pPooledSetEachWithin30": 0.72692,
     "pPooledOneSetWithin30": 0.9957,
     "pPooledSetEachWithin20": 0.27892
    }
   ],
   "note": "Simulated nights of m children on the Candy bag wheel, one spin per child per house; each night continues until every child alone has a set and the pooled haul has a set each, so all four columns come from the same nights. aloneEachMean averages over the m children (the same quantity as candyBag.meanHouses). Checked: pooledOneSetMean, pooledSetEachMean, aloneAllMean and pPooledSetEachWithin30; the other shares are reported, not checked (their exact values are in theory.pooling)."
  }
 },
 "checks": [
  {
   "name": "candy bag, one child: average houses for a full set",
   "kind": "simulated vs exact",
   "simulated": 34.55368,
   "exact": 34.550333,
   "se": 0.0309,
   "z": 0.11,
   "tolerance": 0.124,
   "pass": true
  },
  {
   "name": "candy bag, one child: P(full set within 20 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.23579,
   "exact": 0.235444,
   "se": 0.000671,
   "z": 0.52,
   "tolerance": 0.00268,
   "pass": true
  },
  {
   "name": "candy bag, one child: P(full set within 30 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.524578,
   "exact": 0.524793,
   "se": 0.00079,
   "z": -0.27,
   "tolerance": 0.00316,
   "pass": true
  },
  {
   "name": "candy bag, one child: P(full set within 40 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.720975,
   "exact": 0.721028,
   "se": 0.000709,
   "z": -0.07,
   "tolerance": 0.00284,
   "pass": true
  },
  {
   "name": "candy bag, one child: P(full set within 50 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.837228,
   "exact": 0.837294,
   "se": 0.000584,
   "z": -0.11,
   "tolerance": 0.00233,
   "pass": true
  },
  {
   "name": "candy bag, one child: P(full set within the exact 10th percentile, 16 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.117553,
   "exact": 0.117031,
   "se": 0.000508,
   "z": 1.03,
   "tolerance": 0.00203,
   "pass": true
  },
  {
   "name": "candy bag, one child: P(full set within the exact 90th percentile, 60 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.904258,
   "exact": 0.904559,
   "se": 0.000465,
   "z": -0.65,
   "tolerance": 0.00186,
   "pass": true
  },
  {
   "name": "candy bag: average houses until the first Candy corn",
   "kind": "simulated vs exact",
   "simulated": 20.006722,
   "exact": 20,
   "se": 0.0308,
   "z": 0.22,
   "tolerance": 0.123,
   "pass": true
  },
  {
   "name": "candy bag: average houses until both one-piece kinds (Mints, Candy corn)",
   "kind": "simulated vs exact",
   "simulated": 29.988465,
   "exact": 30,
   "se": 0.0343,
   "z": -0.34,
   "tolerance": 0.137,
   "pass": true
  },
  {
   "name": "candy bag: average houses until the six kinds with 2+ pieces",
   "kind": "simulated vs exact",
   "simulated": 19.91029,
   "exact": 19.918387,
   "se": 0.0161,
   "z": -0.5,
   "tolerance": 0.0642,
   "pass": true
  },
  {
   "name": "candy bag: P(the last kind found is a one-piece kind)",
   "kind": "simulated vs exact",
   "simulated": 0.629202,
   "exact": 0.629118,
   "se": 0.000764,
   "z": 0.11,
   "tolerance": 0.00306,
   "pass": true
  },
  {
   "name": "candy bag: Chocolate bar pieces when the set is complete (Wald)",
   "kind": "simulated vs exact",
   "simulated": 8.640065,
   "exact": 8.637583,
   "se": 0.00933,
   "z": 0.27,
   "tolerance": 0.0373,
   "pass": true
  },
  {
   "name": "candy bag: Candy corn pieces when the set is complete (Wald)",
   "kind": "simulated vs exact",
   "simulated": 1.725405,
   "exact": 1.727517,
   "se": 0.00194,
   "z": -1.09,
   "tolerance": 0.00777,
   "pass": true
  },
  {
   "name": "favorite: houses until the first Chocolate bar",
   "kind": "simulated vs exact",
   "simulated": 3.996225,
   "exact": 4,
   "se": 0.00548,
   "z": -0.69,
   "tolerance": 0.0219,
   "pass": true
  },
  {
   "name": "favorite: houses until 3 Chocolate bar pieces",
   "kind": "simulated vs exact",
   "simulated": 11.995228,
   "exact": 12,
   "se": 0.00949,
   "z": -0.5,
   "tolerance": 0.0379,
   "pass": true
  },
  {
   "name": "favorite: houses until 3 Candy corn pieces",
   "kind": "simulated vs exact",
   "simulated": 60.011877,
   "exact": 60,
   "se": 0.0534,
   "z": 0.22,
   "tolerance": 0.214,
   "pass": true
  },
  {
   "name": "favorite: P(3 Candy corn pieces within 30 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.187715,
   "exact": 0.187821,
   "se": 0.000618,
   "z": -0.17,
   "tolerance": 0.00247,
   "pass": true
  },
  {
   "name": "even bag (8 kinds, equal chances): average houses for a full set",
   "kind": "simulated vs exact",
   "simulated": 21.784395,
   "exact": 21.742857,
   "se": 0.0195,
   "z": 2.13,
   "tolerance": 0.078,
   "pass": true
  },
  {
   "name": "even bag (8 kinds, equal chances): P(full set within 30 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.85868,
   "exact": 0.859301,
   "se": 0.000778,
   "z": -0.8,
   "tolerance": 0.00311,
   "pass": true
  },
  {
   "name": "even bag (8 kinds, equal chances): P(full set within the exact median, 20 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.52904,
   "exact": 0.530558,
   "se": 0.00112,
   "z": -1.36,
   "tolerance": 0.00446,
   "pass": true
  },
  {
   "name": "even bag (8 kinds, equal chances): P(full set within the exact 90th percentile, 33 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.90412,
   "exact": 0.90452,
   "se": 0.000657,
   "z": -0.61,
   "tolerance": 0.00263,
   "pass": true
  },
  {
   "name": "moved piece (one Chocolate bar becomes Candy corn): average houses for a full set",
   "kind": "simulated vs exact",
   "simulated": 29.656005,
   "exact": 29.640075,
   "se": 0.0371,
   "z": 0.43,
   "tolerance": 0.148,
   "pass": true
  },
  {
   "name": "moved piece (one Chocolate bar becomes Candy corn): P(full set within 30 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.64443,
   "exact": 0.644858,
   "se": 0.00107,
   "z": -0.4,
   "tolerance": 0.00428,
   "pass": true
  },
  {
   "name": "moved piece (one Chocolate bar becomes Candy corn): P(full set within the exact median, 25 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.506635,
   "exact": 0.505751,
   "se": 0.00112,
   "z": 0.79,
   "tolerance": 0.00447,
   "pass": true
  },
  {
   "name": "moved piece (one Chocolate bar becomes Candy corn): P(full set within the exact 90th percentile, 50 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.90282,
   "exact": 0.903399,
   "se": 0.000661,
   "z": -0.88,
   "tolerance": 0.00264,
   "pass": true
  },
  {
   "name": "2 children pooling: average houses for one pooled set",
   "kind": "simulated vs exact",
   "simulated": 17.535347,
   "exact": 17.525153,
   "se": 0.0253,
   "z": 0.4,
   "tolerance": 0.101,
   "pass": true
  },
  {
   "name": "2 children pooling: average houses for a set each (every kind 2+ times)",
   "kind": "simulated vs exact",
   "simulated": 29.674993,
   "exact": 29.697589,
   "se": 0.0337,
   "z": -0.67,
   "tolerance": 0.135,
   "pass": true
  },
  {
   "name": "2 children alone: average houses until every child has a set",
   "kind": "simulated vs exact",
   "simulated": 44.49736,
   "exact": 44.540404,
   "se": 0.0551,
   "z": -0.78,
   "tolerance": 0.221,
   "pass": true
  },
  {
   "name": "2 children pooling: P(a set each within 30 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.620767,
   "exact": 0.620465,
   "se": 0.00125,
   "z": 0.24,
   "tolerance": 0.00501,
   "pass": true
  },
  {
   "name": "3 children pooling: average houses for one pooled set",
   "kind": "simulated vs exact",
   "simulated": 11.864258,
   "exact": 11.850076,
   "se": 0.0188,
   "z": 0.75,
   "tolerance": 0.0754,
   "pass": true
  },
  {
   "name": "3 children pooling: average houses for a set each (every kind 3+ times)",
   "kind": "simulated vs exact",
   "simulated": 27.628325,
   "exact": 27.652001,
   "se": 0.0302,
   "z": -0.78,
   "tolerance": 0.121,
   "pass": true
  },
  {
   "name": "3 children alone: average houses until every child has a set",
   "kind": "simulated vs exact",
   "simulated": 50.920283,
   "exact": 50.9381,
   "se": 0.0641,
   "z": -0.28,
   "tolerance": 0.256,
   "pass": true
  },
  {
   "name": "3 children pooling: P(a set each within 30 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.680992,
   "exact": 0.681527,
   "se": 0.00134,
   "z": -0.4,
   "tolerance": 0.00538,
   "pass": true
  },
  {
   "name": "4 children pooling: average houses for one pooled set",
   "kind": "simulated vs exact",
   "simulated": 9.01411,
   "exact": 9.012657,
   "se": 0.0155,
   "z": 0.09,
   "tolerance": 0.062,
   "pass": true
  },
  {
   "name": "4 children pooling: average houses for a set each (every kind 4+ times)",
   "kind": "simulated vs exact",
   "simulated": 26.49143,
   "exact": 26.49813,
   "se": 0.0284,
   "z": -0.24,
   "tolerance": 0.114,
   "pass": true
  },
  {
   "name": "4 children alone: average houses until every child has a set",
   "kind": "simulated vs exact",
   "simulated": 55.6015,
   "exact": 55.685706,
   "se": 0.0718,
   "z": -1.17,
   "tolerance": 0.287,
   "pass": true
  },
  {
   "name": "4 children pooling: P(a set each within 30 houses)",
   "kind": "simulated vs exact",
   "simulated": 0.72692,
   "exact": 0.725961,
   "se": 0.00141,
   "z": 0.68,
   "tolerance": 0.00564,
   "pass": true
  }
 ]
}
