There’s something that has troubled me since childhood. In *Charlie and the chocolate factory*, one of the lucky children (Veruca Salt) gets her golden ticket thanks to her father repruposing his peanut shelling factory in a chocolate-bar-unwrapping factory.

Now, there are only five golden tickets, and chocolate bars in the book seem quite popular. How many bars would one need to buy (and unwrap) just to have a seizable chance of finding one of the tickets? Most likely a lot. After doing the maths, I would estimate the number of chocolate bars that Mr. Salt had to buy to something between **12 and 40 million chocolate bars**; which means this promotional campaign was most certainly one of the most profitable in history. Details below.

## Background: *Charlie and the chocolate factory*

In *Charlie and the Chocolate Factory*, Roald Dahl pictured the archetype of the spoiled little child in the character of Veruca Salt (left). When Willy Wonka, an excentric, genius chocolate maker, announces that five golden tickets have been hidden underneath the wrapping of ordinary chocolate bars, granting their lucky discoverers a visit of his chocolate factory and a lifetime supply of sweets, the world goes into a chocolate-devouring frenzy. It’s only a few days before the first and second ticket are found, the later by a girl named Veruca Salt. Here is how her father explains the discovery

‘You see, boys,’ he had said, ‘as soon as my little girl told me that she simply had to have one of those Golden Tickets, I went out into the town and started buying up all the Wonka bars I could lay my hands on. Thousands of them, I must have bought. Hundreds of thousands!

## So how many chocolate bars did Mr. Salt actually buy?

Assume Mr. Salt wants to have a reasonable chance of finding one of the tickets, perhaps 70 or 80%. Let \(\alpha\) be the acceptable risk level, so that the probability of actually finding the ticket is \(1 – \alpha\). Since televisions seem rather common in the book, and it was published in 1964, assume the action takes place in the early 1960’s. Say the children population of England at the time is \(P\), and assume Mr. Wonka makes most of his business in this country, and only with children (including other countries, or adults, would further reduce Mr. Salt’s chances of success). There are \(T = 5\) golden tickets in play, and we can estimate the number of bars sold per child to \(b =\) three or more, given that Charlie Bucket, though extremely poor, buys three.

Excluding Mr. Salt compulsive buying, this generates a total static demand \(D = P \times b\). Let \(N\) be the number of chocolate bars sold in total, and \(n\) the number of bars bought by the Salt family, so \(N = D + n\) — the underlying assumption being that chocolate production is profitable at any level.

The chance of these \(n\) bars yielding no golden ticket is \(\binom{N-T}{n} / \binom{N}{n}\); conversely, the probability of at least one of these \(n\) bars contains a golden ticket is \(1 – \binom{N-T}{n} / \binom{N}{n}\). Assuming the family is ready to accept a probability of failure of \(\alpha\), \(n\) will be chosen so that \(1 – \binom{N-T}{n} / \binom{N}{n} > 1 – \alpha\), or equivalently that $$ \binom{N-T}{n} < \alpha \binom{N}{n} $$
Developing this expression and substituing [latex]N - D[/latex] for [latex]n[/latex] yields [latex](N - T)! / (D - T)! < \alpha (N! / D!)[/latex], which is the same as $$ \frac{D!}{(D - T)!} < \alpha \frac{N!}{(N - T)!} $$
The children population of England in the 60's was about [latex]12.2[/latex] million kids^{1}. Assuming each bought 3 chocolate bars, the static demand was \(36.6\) million bars. Finally, setting \(T = 5\) and numerically solving the equation above yields \(N \approx 49.6\) million chocolate bars, and thus \(n = 12.9\) million chocolate bars.

In other words, Mr. Salt would need to buy **12.9 million chocolate bars** to reach a 70% chance of securing a golden ticket. Taking this probability up to 95% would imply buying an extra 28 million chocolate bars, bringing the grand total to about **41 million chocolate bars**.^{2}

### Code

Here’s the Octave/Matlab code used to numerically solve the inequation above. The key is to notice that \(\frac{D!}{(D – T)!}\) and \(\frac{N!}{(N – T)!}\) are both values taken by the monotonically increasing polynomial \(f(X) = \frac{X!}{(X-T)!} = \prod_{k=0}^{T-1} (X – k)\). Thus the inequation can be rewritten as \(g(N) > 0\), where \(g(N) = (f(N)/f(D)) – (1/\alpha)\).

function y = f(x, T) y = prod(x - (1:(T-1))); endfunction function y = g(N, D, T, alpha) y = f(N, T)/f(D, T) - 1/alpha; endfunction N = fzero(@(x) g(x, 36.7e6, 5, 0.3), [10e6, 10e20]);

Illustration by Quentin Blake. Title image from wikimedia.

- Source: World dataBank, indicators SP.POP.0014.TO.ZS and SP.POP.TOTL; the population of the time was 52.4 million people, and the percentage of children aged less than 15 was 23.3% [↩]
- If you include English adults in this funny little buying game, the static demand reaches 76.9 million chocolate bars, pushing the 70% to \(N = 104\) million chocolate bars (\(n = 27\) million), and the 95% probability threshold to \(N = 162\) million chocolate bars (\(n = 85.7\) million). [↩]

OpenKindeed a very good marketing strategy (seen the film a few days ago), that seems to have inspired this one : http://www.micheletaugustin.com/4vachesenortokyo !