Monday, 3 June 2019

Project Euler 151 - Paper sheets of standard sizes: an expected-value problem

A printing shop runs 16 batches (jobs) every week and each batch requires a sheet of special colour-proofing paper of size A5.

Every Monday morning, the foreman opens a new envelope, containing a large sheet of the special paper with size A1.

He proceeds to cut it in half, thus getting two sheets of size A2. Then he cuts one of them in half to get two sheets of size A3 and so on until he obtains the A5-size sheet needed for the first batch of the week.

All the unused sheets are placed back in the envelope.

At the beginning of each subsequent batch, he takes from the envelope one sheet of paper at random.
If it is of size A5, he uses it. If it is larger, he repeats the 'cut-in-half' procedure until he has what he needs and any remaining sheets are always placed back in the envelope.

Excluding the first and last batch of the week, find the expected number of times (during each week) that the foreman finds a single sheet of paper in the envelope.

Give your answer rounded to six decimal places using the format x.xxxxxx .

Solution 

After round 1, we have
(A2, A3, A4, A5), 1. 1 denotes the probability of this combination.

After round 2, we have
(A2, A3, A4), 1/4
(2*A3, 2*A4, 2*A5), 1/4
(A2, 2*A4, 2*A5), 1/4
(A2, A3, 2*A5), 1/4

After round 3, we have
(2*A3, 2*A4, A5), 1/12
(A2, 2*A4, A5), 1/12
(A2, A3, A5), 1/12
(A3, 3*A4, 3*A5), 1/12
(2*A3, A4, 3*A5), 1/12
(2*A3, 2*A4, A5), 1/12
(A3, 3*A4, 3*A5), 1/20
(A2, A4, 3*A5), 1/10
(A2, 2*A4, A5), 1/10
(2*A3, A4, 3*A5), 1/16
(A2, A4, 3*A5), 1/16
(A2, A3, A5), 1/8

Then we add the probability for the same combination

(2*A3, 2*A4, A5), 1/12 + 1/12
(A2, 2*A4, A5), 1/12 + 1/10
(A2, A3, A5), 1/12 + 1/8
(A3, 3*A4, 3*A5), 1/12 + 1/20
(2*A3, A4, 3*A5), 1/12 + 1/16
(A2, A4, 3*A5), 1/10 + 1/16

Repeat the process for 14 rounds, then look for the combination that has one sheet of paper.

No comments:

Post a Comment