## Friday, March 17, 2017

### Pi (π) Day puzzles

PHOTO: Pi, oh my
Illustration: Brilliant.org

https://1.bp.blogspot.com/-N1IbUfJsQNU/WMt2raOdKzI/AAAAAAAAmTw/VxGoOTXmRVg1qSnPrEfgZBNI4srKYKmngCLcB/s1600/698.png
https://i.guim.co.uk/img/media/6761bf29081fd18320052fedd665200b902a79ba/0_0_698_268/master/698.png?w=620&q=55&auto=format&usm=12&fit=max&s=d3fe28a06878d2e59063b822dab1fc00
https://www.theguardian.com/science/2017/mar/13/did-you-solve-it-pi-day-puzzles-that-will-leave-you-pie-eyed

Solution
A, B and C contain equal amounts of pie.

The tastiest solution is to consider box B as a square box made from four smaller square boxes, and box C as a square box made from 16 smaller square boxes. Pie fills the same percentage of each box, whatever the size of the box. So pie must fill the same percentage of A, B and C. In other words, the amount of pie is the same in each box.

But if you wanted to overcomplicate things, you can also solve with pi. As you remember from school, the area of a circle is pi x (radius)², or πr². Let the radius of the smallest pies (in C) be r, which means the radius of the medium pies (in B) is 2r and the radius of the big pi is 4r. Then the area of pie in A is π (4r)² = 16r², the area of pie in B is 4 x π (2r)² = 16r², and the area of pie in C is 16π (r)² = 16r². All the same!

PHOTO: How well did we do? Here are the results, with the results in parentheses of those who attempted the problem on Brilliant.org. Congrats Guardianistas, you smashed it!
• A has the most pie: 23 per cent (21 per cent)
• B has the most pie: 2 per cent (3 per cent)
• C has the most pie: 10 per cent (18 per cent)
• A, B and C have equal amounts: 65 per cent (58 per cent)
Picture posted by Sports Illustrated, saved by Doctor Charcuterie to Rah Rah Riot, Pinterest
https://2.bp.blogspot.com/-TuOttsL9e2M/WMt2qjLbtuI/AAAAAAAAmTk/CQTFeC_krIkP67LxyiWY1G49hAWplAPhQCLcB/s1600/0835e014cdfc1f0c54d45c37a23c897f.jpg
https://s-media-cache-ak0.pinimg.com/564x/08/35/e0/0835e014cdfc1f0c54d45c37a23c897f.jpg
https://www.pinterest.com/lee7343/rah-rah-riot/

2) One hundred computers are connected in a 10x10 network grid, as below. At the start exactly nine of them are infected with a virus. The virus spreads like this: if any computer is directly connected to at least 2 infected neighbours, it will also become infected.

Will the virus infect all 100 computers?

PHOTO: if any computer is directly connected to at least 2 infected neighbours, it will also become infected.
Will the virus infect all 100 computers?
Illustration: Brilliant.org
https://4.bp.blogspot.com/-GWavs3Ivb4Q/WMt2raFTTNI/AAAAAAAAmTs/IpiCb1oy_roZ-_DmB36EP_iHpLjbgycOwCLcB/s1600/804.png
https://i.guim.co.uk/img/media/2292a89b363df5048580b942172ddbaa7b647617/0_0_804_808/master/804.png?w=620&q=55&auto=format&usm=12&fit=max&s=c05d408dc96c432b2b89a47ef796b819
https://www.theguardian.com/science/2017/mar/13/did-you-solve-it-pi-day-puzzles-that-will-leave-you-pie-eyed

The image shows a possible example of the initial infection. You can try to fill it in to see if ultimately the network will consist of 100 orange dots. But the question is not asking what happens to this example. I want to know what will happen given any initial configuration of infected computers.

Solution
No, the virus will not infect all 100 computers.

The solution is simple to understand, although you would have needed some impressive insight to get there on your own.

They key here is the perimeter of the infection. By perimeter, I mean the length of the boundary of the infection.

For the infection to infect all computers, then the final boundary must be 40, since the perimeter of an infected 10x10 square is 10 + 10 + 10 + 10 = 40

Note that the infection can be a single area, or it can be made up of many separate areas. If it is many separate areas, we need to combine the perimeters of all the infected areas.

The perimeter of a single infected computer is 4, as below. So the perimeter of nine infected computers will be maximum 36, which is 4 x 9. (This is the case when no infected computers are adjacent, as in the image above.

But the perimeter may be much lower. For example, if the infected computers are all on the same row, the boundary will only be 9 + 9 + 1 + 1 = 20)

PHOTO: Perimeter of a single infected computer is 4
Illustration: Alex Bellos

https://4.bp.blogspot.com/-XEW8Fy3PSTw/WMt2qQEj3jI/AAAAAAAAmTc/lB0x-Vh3ycwR3CI5Bf7d1UveJsY0nG4awCLcB/s1600/1944.jpg
https://www.theguardian.com/science/2017/mar/13/did-you-solve-it-pi-day-puzzles-that-will-leave-you-pie-eyed

The beautiful part of this problem is the fact that the perimeter of the infection never increases as the infection grows. Consider what happens when an uninfected computer is infected by two computers. Two of its sides are absorbed into the infected area, and the other two become part of the perimeter of the infected area. The perimeter loses 2 and gains 2, a net change of 0. We can see this in the mini-grid below. In A, the infected area has a perimeter 8. In B, a new computer is infected, yet the perimeter of the infected area remains 8. Likewise in C, another computer is infected, and the perimeter remains 8.

PHOTO: An uninfected computer is infected by two computers
Illustration: Alex Bellos

https://1.bp.blogspot.com/-5qXK1OYm-O0/WMt2qvdrwxI/AAAAAAAAmTg/VatmJUvTDJg-HKdjSj85EWYTdOeBK4E_wCLcB/s1600/1952.jpg