Five Things #25

Sonya, Josephine, and the Tragic Re-Invention of the Telephone by I. S. Heynen is a powerful slice of dystopian fiction.

Chris Grey suggests that Brexit is going feral, and examines the consequences.

Denzil visits The Vlooyberg Tower near Tielt-Winge.

Ben Orlin asks What Makes a Great Teacher? With answers from four great teachers.

And another wolf has been sighted in Belgium. This time in Liège.

Five Things #21

KT Bryski provides a very different take on the story of Red Riding Hood in The Path of Pins, the Path of Needles.

In 2008 Rian Dundon spent 9 months on the road with Fan Bingbing, China’s biggest movie star, and gained a firsthand look at the country’s celebrity-industrial complex.

There are exactly two wolves in the wild in Flanders at present. Pups could be on the way.

Nick Tyrone discusses three things the left gets wrong. Repeatedly.

Ben Orlin presents The Game of Snakes. All you need is a pen and a bit of paper.

Five Things #10

For He Can Creep by Siobhan Carroll is a dark fantasy about Jeoffry, a cat who fights demons, Jeoffry’s human, a poet, who is confined to an insane asylum, and Satan, who schemes.

Stephen Dowling suggests that cats are more social than we realise.

Margaret Schotte asks how the sailors of early modern Europe learn to traverse the world’s seas. The answer: they learned maths.

Nick Barlow argues that the first past the post electoral system is a significant factor in why British politics is broken.

And Luke at Start Your Meeples suggests four opening strategies for Hive.

Five Things #7: Better late than never

This post has taken quite a bit longer to complete than I expected, so apologies in advance if a couple of the below links feel a bit stale. They’re still worth reading, though.

“Hence gradually the onion skins have been peeled away until the fetid heart of [Brexit] is exposed: not a policy but an undeliverable fantasy composed of lies and articulated in the language of spite, contempt and hate.” — Chris Grey on the Supreme Court judgment and its aftermath.

On a related note, Nick Barlow points out that democracy is a process, not an event.

I loved Spitting Image back in the day and was delighted to hear that the satirical puppet show is making a a comeback. Adam J Smith and Jo Waugh take this opportunity to point out that there has been a problem inherent in British caricature for 300 years.

Ben Orlin explains why 1 isn’t a prime number.

And Wumo explains the stock market:

wumo5d96018cbfb3c3.67833360

Five things #6

“But who’s the real freak – the activist whose determination has single-handedly started a powerful global movement for change, or the middle-aged man taunting a child with Asperger syndrome from behind the safety of their computer screens?” Jennifer O’Connell asks why Greta Thunberg is so triggering for certain men.

Jesse Singal discusses Dave Chappelle, political correctness and cancel culture and argues that we should recognise the elitism of the Super-Woke.

David Spiegelhalter discusses the importance of statistical literacy, and plugs his book a couple of times. The book is The Art of Statistics and I do plan on reading it once the paperback edition is published.

As Rambo: Last Blood arrives on the big screen, Mark Harrison looks back at Son Of Rambow and the joys of DIY filmmaking.

And finally: Happy birthday COBOL. 60 years old this month and still surprisingly popular. There’s hope for me yet.

A European adult with a computer can be as smart as a Vietnamese Eight year old

I’m quite liking the puzzles coming out of Alex Bellos’s Adventures in Numberland. This week’s challenge: Can you do the maths puzzle for Vietnamese eight-year-olds that has stumped parents and teachers?

You have a simple arithmetic equation and you have to place the digits from one to 9 in the grid so that the result is 66. And I thought that sounded pretty easy – there are only 362880 possible combinations, I just need a trial and error method to work through the combinations until I find the right one.

Thank you Python.

Firstly, a function to yield all the possible permutations in a list

def yield_permutations(the_list):
    """ Yields all permutations for a list """
    length = len(the_list)
    if length <= 1:
        yield the_list
    else:
        for i in range(0, length):
            for j in yield_permutations(the_list[:i] + the_list[i+1:]):
                yield [the_list[i]] + j

And then I just need to plug the values into the formula

digits = []
for i in range(1, 10): 
    digits.append(i)

for x in yield_permutations(digits):
    result = x[0] + 13 * x[1] / x[2] + x[3] + 12 * x[4] - x[5] - 11 + x[6] * x[7] / x[8] - 10
    print(x, result)
    if result == 66:
        break

I’m sure there is a more elegant way of doing this, but after checking my result by hand, I can confirm that this approach also works.

Einstein’s election riddle

Back before we were all online, I used to spend quite a lot of time doing logic puzzles. These are problems in which you have a series of groups, a series of statements and have to figure out which elements make up each group. So when Alex Bellos posted an election themed puzzle a few days before the big day, I couldn’t resist.

There are five houses with the outside walls painted in five different ways. David, Ed, Nick, Nicola and Nigel each live in one of the houses. They each drink a certain type of coffee, have a preferred mode of transport and keep a certain pet. No owners have the same pet, the same preferred mode of transport or drink the same type of coffee.

Who owns the fish?

You will need to click through to see the actual statements about who lives where, what they drink and how they travel.

It took me a couple of hours (spread over most of a day) but I solved it, and then I checked the published solution. What struck me as interesting is that, while my approach worked, it was not the same approach as the one Alex used. You can see the approach taken by Alex, along with the solution, by clicking here. The approach I took is as follows:

I started with a grid like this one (except the grid I used was hand drawn with a ruler and pencil).

fish0

The first two statements tell us that Nicola lives in the tartan house and Ed has a guinea pig. This also tells us that the owner of the guinea pig doesn’t live in the tartan house.

fish1

Statement three tells us that David drinks mochaccino. Which means that the mochaccino drinker does not live in the tartan house and does not own a guinea pig.

fish2

And so on and so forth. And once the grid is filled you have your answer.

The article repeats the claim that only two per cent of the population are smart enough to solve it. I don’t think this is a question of being smart.

With any sort of logic problem you need to have some method of systematically capturing what is true and what is not true. Evidently more than one such method exists, but once you have a working methodology, these problems are solvable for anyone.

So if it is true that only two percent of the population are able to solve the puzzle, this does not tell us how smart people are but, instead, indicates that far too many people lack the skills to process information methodologically.

Also, what the hell is mochaccino?

Exponential Origami

Raju Varghese (via Sploid) claims that if you fold a piece of paper 103 times, the thickness of your paper will be larger than the diameter of the observable universe: 93 billion light years. The explanation is simple enough – every time you fold a piece of paper you double its thickness and when you start doubling things they get very large very quickly – but I couldn’t leave this without checking the numbers for myself.

Of course, I couldn’t resist checking this for myself and pulled out a calculator. I soon found that the mental juggling needed to get from fractions of millimetres to kilometres was too much for my little brain and converting between millimetres and light years was going to be impossible.

So I wrote a script. The code is pretty simple, as you can see below, although I did have a four fold discrepancy when I first ran it (I came up with 107 folds needed, rather than 103). It turned out that my initial thickness of the paper was out by a factor of 10. Once I fixed this, everything matched.

#!/usr/bin/env python
""" Foldpaper
    Calculates the thickness of a piece of paper after n folds """

thickness = 0.1
folds = 0
meter = 1000
kilometer = 1000000
lightyear = 1000000 * 9000000000000
size_of_universe_in_mm = 93000000000 * lightyear

while thickness  1:
        print(folds, int(thickness/lightyear), 'light years')
    elif int(thickness / kilometer) > 1:
        print(folds, int(thickness/kilometer), 'kilometers')
    elif int(thickness / meter) > 1:
        print(folds, int(thickness/meter), 'meters')
    else:
        print(folds, thickness, 'mm')

And then, with a slight edit, I dumped the results into a table so that I could add a few comparative distances.

Folds Height Notes
15 3 metres Taller than the average human
22 419 metres Taller than The Shard in London
27 13 kilometres We’re now standing higher than Mount Everest
42 439804 kilometres Now we’ve just passed the Moon
51 225179981 kilometres And the Sun
56 7205759403 kilometres And finally we reach Pluto
69 6 light years With a single fold, we have shot past Alpha Centuri
83 107460 light years And now the thickness of our piece of paper is larger than the Milky Way
88 3438722 light years And in a few short folds, we pass Andromeda
103 112680053353 light years And with that final fold, we have exceeded the size of the Universe

Exponentiation is awesome.

Prime pair sets

I started playing around with Project Euler way back in November 2011, not least as an opportunity to hone my still nascent Python skills. And I’m still learning.

Problem 60 states:

The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are prime. The sum of these four primes, 792, represents the lowest sum for a set of four primes with this property.

Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime.

This took a bit of thinking about but the approach I eventually came up with was to create a set of concetanatable primes for each prime (up to an arbitarily chosen value of 10000). Then all I would need to do is search each set for intersecting elements until I found five intersecting sets. Since the primes are generated in order, from lowest to highest, the first set of five intersecting sets will give me the answer.

Then for the implementation…

I already have a function that returns a list of primes, so that was easy, and using a dictionary keyed by prime was a no-brainer, but looking for set intersections was a bit of a struggle. Until I discovered that Python will do it for me. Using the set class it becomes remarkably easy to build a dictionary of sets and then work through them, checking intersections, until I find five sets that intersect.

My actual code is neither nice nor fast, and it isn’t going to scale at all – but I am quite pleased to have gained a handle on yet another iterable type.