# Blog

## Archive

Show me a Random Blog Post**2017**

### Jun 2017

Big Ben Strikes Again### Mar 2017

The End of Coins of Constant WidthDragon Curves II

### Feb 2017

The Importance of Estimation Error### Jan 2017

Is MEDUSA the New BODMAS?**2016**

**2015**

**2014**

**2013**

**2012**

## Tags

folding paper folding tube maps london underground platonic solids london rhombicuboctahedron raspberry pi weather station programming python php inline code news royal baby probability game show probability christmas flexagons frobel coins reuleaux polygons countdown football world cup sport stickers tennis braiding craft wool emf camp people maths trigonometry logic propositional calculus twitter mathslogicbot oeis pac-man graph theory video games games chalkdust magazine menace machine learning javascript martin gardner reddit national lottery rugby puzzles advent game of life dragon curves fractals pythagoras geometry triangles european cup dates palindromes chalkdust christmas card bubble bobble asteroids final fantasy curvature binary arithmetic bodmas statistics error bars estimation accuracy misleading statistics pizza cutting captain scarlet gerry anderson light sound speed**2016-12-28**

## Christmas (2016) is Over

More than ten correct solutions to this year's Advent calendar puzzle competition were submitted on Christmas Day, so the competition is now over.
(Although you can still submit your answers to get me to check them.) Thank-you to everyone who took part in the puzzle, I've had a lot of
fun watching your progress and talking to you on Twitter, Reddit, etc. You can find all the puzzles and answers (from 1 January) here.

The (very) approximate locations of all the entries I have received so far are shown on this map:

This year's winners have been randomly selected from the 29 correct entries on Christmas Day. They are:

1 | Jack Jiang |

2 | Steve Paget |

3 | Joe Gage |

4 | Tony Mann |

5 | Stephen Cappella |

6 | Cheng Wai Koo |

7 | Demi Xin |

8 | Lyra |

9 | David Fox |

10 | Bob Dinnage |

Your prizes will be on their way in early January.

Now that the competition has ended, I can give away a secret. Last year, Neal
suggested that it would be fun if a binary picture was hidden in the answers. So this year I hid one. If you write all the answers in binary, with
each answer below the previous and colour in the 1s black, you will see this:

I also had a lot of fun this year making up the names, locations, weapons and motives for the final murder mystery puzzle. In case you missed them these were:

# | Murder suspect | Motive |

1 | Dr. Uno (uno = Spanish 1) | Obeying nameless entity |

2 | Mr. Zwei (zwei = German 2) | To worry others |

3 | Ms. Trois (trois = French 3) | To help really evil elephant |

4 | Mrs. Quattro (quattro = Italian 4) | For old unknown reasons |

5 | Prof. Pum (pum = Welsh 5) | For individual violent end |

6 | Miss. Zes (zes = Dutch 6) | Stopping idiotic xenophobia |

7 | Lord Seacht (seacht = Irish 7) | Suspect espied victim eating newlyweds |

8 | Lady Oito (oito = Portuguese 8) | Epic insanity got him today |

9 | Rev. Novem (novem = Latin 9) | Nobody in newsroom expected |

# | Location | Weapon |

1 | Throne room | Wrench (1 vowel) |

2 | Network room | Rope (2 vowels) |

3 | Beneath reeds | Revolver (3 vowels) |

4 | Edge of our garden | Lead pipe (4 vowels) |

5 | Fives court | Neighbour's sword (5 vowels) |

6 | On the sixth floor | Super banana bomb (6 vowels) |

7 | Sparse venue | Antique candlestick (7 vowels) |

8 | Weightlifting room | A foul tasting poison (8 vowels) |

9 | Mathematics mezzanine | Run over with an old Ford Focus (9 vowels) |

Finally, well done to Scott,
Matthew Schulz,
Michael Gustin,
Daniel Branscombe,
Kei Nishimura-Gasparian,
Henry Hung,
Mark Fisher,
Jon Palin,
Thomas Tu,
Félix Breton,
Matt Hutton,
Miguel,
Fred Verheul,
Martine Vijn Nome,
Brennan Dolson,
Louis de Mendonca,
Roni,
Dylan Hendrickson,
Martin Harris,
Virgile Andreani,
Valentin Valciu,
and Adia Batic for submitting the correct answer but being too unlucky to win prizes this year. Thank you all for taking part and I'll see you
next December for the next competition.

### Similar Posts

Christmas (2016) is Coming! | Christmas (2015) is Over | Christmas (2015) is Coming! | Christmas Card 2016 |

### Comments

Comments in green were written by me. Comments in blue were not written by me.

**2017-01-19**

Thanks for setting this all up; I had a lot of fun solving the puzzles every day (and solving half them again when my cookie for the site somehow got deleted). I'll be sure to participate next time too!

SC

**2016-12-28**

Jack

**Add a Comment**

**2016-12-20**

## Christmas Card 2016

Last week, I posted about the Christmas card I designed on the Chalkdust blog.

The card looks boring at first glance, but contains 12 puzzles. Converting the answers to base 3, writing them in the boxes on the front, then colouring the 1s green and 2s red will reveal a Christmassy picture.

If you want to try the card yourself, you can download this pdf. Alternatively, you can find the puzzles below and type the answers in the boxes. The answers will be automatically converted to base 3 and coloured...

# | Answer (base 10) | Answer (base 3) | ||||||||

1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

11 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |

12 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |

- The square number larger than 1 whose square root is equal to the sum of its digits.
- The smallest square number whose factors add up to a different square number.
- The largest number that cannot be written in the form \(23n+17m\), where \(n\) and \(m\) are positive integers (or 0).
- Write down a three-digit number whose digits are decreasing. Write down the reverse of this number and find the difference. Add this difference to its reverse. What is the result?
- The number of numbers between 0 and 10,000,000 that do not contain the digits 0, 1, 2, 3, 4, 5 or 6.
- The lowest common multiple of 57 and 249.
- The sum of all the odd numbers between 0 and 66.
- One less than four times the 40th triangle number.
- The number of factors of the number \(2^{756}\)×\(3^{12}\).
- In a book with 13,204 pages, what do the page numbers of the middle two pages add up to?
- The number of off-diagonal elements in a 27×27 matrix.
- The largest number, \(k\), such that \(27k/(27+k)\) is an integer.

### Similar Posts

Christmas (2016) is Over | Christmas (2016) is Coming! | Christmas (2015) is Over | Christmas (2015) is Coming! |

### Comments

Comments in green were written by me. Comments in blue were not written by me.

**2016-12-20**

Dan Whitman

**2016-12-20**

Matthew

**2016-12-20**

Dan Whitman

**Add a Comment**

**2016-11-27**

## Christmas (2016) is Coming!

This year, the front page of mscroggs.co.uk will feature an advent calendar, just like last year. Behind each door, there will be a puzzle with a three digit solution. The solution to each day's puzzle forms part of a murder mystery logic puzzle in which you have to work out the murderer, motive, location and weapon used: the answer to each of these murder facts is a digit from 1 to 9 (eg. The murderer could be 6, the motive 9, etc.).

As you solve the puzzles, your answers will be stored in a cookie. Behind the door on Christmas Day, there will be a form allowing you to submit your answers. The winner will be randomly chosen from all those who submit the correct answer on Christmas Day. Runners up will then be chosen from those who submit the correct answer on Christmas Day, then those who submit the correct answer on Boxing Day, then the next day, and so on. As the winners will be chosen randomly,

**there is no need to get up at 5am on Christmas Day this year**!The winner will win this array of prizes:

I will be adding to the pile of prizes throughout December. Runners up will get a subset of the prizes. The winner and runners up will also win an mscroggs.co.uk 2016 winners medal:

To win a prize, you must submit your entry before the end of 2016. Only one entry will be accepted per person. Once ten correct entries have been submitted, I will add a note here and below the calendar. If you have any questions, ask them in the comments below or on Twitter.

So once December is here, get solving! Good luck and have a very merry Christmas!

Edit: added picture of this year's medals.

Edit: more than ten correct entries have been submitted, list of prize winners can be found here.
You can still submit your answers but the only prize left is glory.

### Similar Posts

Christmas (2016) is Over | Christmas (2015) is Over | Christmas (2015) is Coming! | Christmas Card 2016 |

### Comments

Comments in green were written by me. Comments in blue were not written by me.

**2016-12-27**

Matthew

**2016-12-27**

Another Matthew

**2016-12-25**

Lyra

**2016-12-25**

Louis

**2016-12-25**

Matthew

**Add a Comment**

**2016-07-04**

## Solving the Cross Diagonal Cover Problem

In five blog posts
(1,
2,
3,
4,
5)
Gaurish Korpal present the Cross diagonal cover problem, some ideas about how to solve it and some conjectures.
In this post, I will present my solution to this problem. But first, the problem itself:

Draw with an \(m\times n\) rectangle, split into unit squares. Starting in the top left corner, move at 45° across
the rectangle. When you reach the side, bounce off. Continue until you reach another corner of the rectangle:

How many squares will be coloured in when the process ends?

### Restating the Problem

When I first saw this problem, it reminded me of Rebounds, a puzzle I posted here
in 2014. To restate the problem in a similar way, we place a point in the centre of each unit square,
then creating a second grid. I will call this the dual grid. The original problem is equivalent to asking, if a line bounces
around the dual grid, how many corners will it pass through.

It it worth noting here that the dual grid is \(n-1\times m-1\): each side is one shorter than the original grid.

A corner cannot be travelled over more than twice: otherwise, the line would be retracing its past path; to do this requires it to have
already hit a corner of the rectangle. Therefore we can calculate the number of distinct corners travelled to using:

$$\text{Distinct corners visited} = \text{Corners visited}-\text{Corners visited twice}$$
### Introducing Mirrors

When I solved Rebounds, I imagined the line passing through mirror images of the rectange, rather then bouncing.
For our example above, it would look like this:

Looking at the puzzle in this way, it can be seen that the line will travel through \(\mathrm{lcm}(n-1,m-1)\) squares, and so hit \(\mathrm{lcm}(n-1,m-1)+1\)
corners (the \(+1\) appears due to fence panels and fence posts).
We have shown that:

$$\text{Corners visited}=\mathrm{lcm}(n-1,m-1)+1$$
### Collisions in the Mirror

To solve the problem, we need to work out how many corners are visited twice; or the number of times the line crosses itself in the rectangle.

To do this, imagine the mirror images of the red line in the mirrors. Ignoring the images parallel to the red line, and terminating
the lines when they hit the red line gives the following diagram:

I have added extra rectangles to the diagram so that all the reflections that hit the red line and their starting points can be seen.
The diagonal black line has been added because all lines outside that clearly cannot intersect the red line.
We now need to justify two claims:

- Each intersection of a red line and a green line corresponds to the line bouncing off the side of the rectangle or crossing itself (in the dual rectangle). Each bounce or crossing matches with exactly one red-green intersection.
- The green lines starting on the outer border are those that correspond to the bounces.

The first claim can be seen by reflecting the green lines and the parts of the red line they hit back into the top left rectangle.

The second claim can be shown in two parts:

First, each line starting from the border will meet the red line on the edge of a rectangle:
this is because the green lines all start a multiple of two rectangles away, and meet at half this distance away (and half a multiple of two
is a whole number).

Conversely, if a red line meets a green line at the edge of a rectangle, then the reflection of the red line in the edge (ie. the green line)
must go back to a starting point on the boundary.

These two claims show that the points where the line crosses itself in the dual rectangle match up one-to-one with the interior points
at which the green lines start. So if we can count these points, we can solve the problem.

### Counting the Interior Points

The green lines will start from all points that are a multiple of two rectangles (in both directions) away from the top left. The reason for
this can be seen by reflecting the first little bit of the red line in all the mirrors:

We see that the perpendicular green lines that we are interested in, plus many other irrelevant lines, start from a grid of points on the
corner of every other rectangle. To count these points, we will extend them into the full square:

To make for clearer counting, I have not drawn the unit squares.

Alternatively, this square can be thought of as being made up from two copies of the triangle.

We next notice that these points can never lie on the diagonal (the diagonal drawn in the diagram): a green point lying on the diagonal would imply
that the red line met a corner before it did. Taking out the lines on which the green dots never lie, we get:

We can now count the green dots. In the square above, there are
\(\displaystyle\frac{\mathrm{lcm}(m-1,n-1)}{m-1}\) rectangles vertically and
\(\displaystyle\frac{\mathrm{lcm}(m-1,n-1)}{n-1}\) rectangles horizontally.
Therefore there are
\(\displaystyle\frac{\mathrm{lcm}(m-1,n-1)}{m-1}-1\) columns of green dots and
\(\displaystyle\frac{\mathrm{lcm}(m-1,n-1)}{n-1}-1\) rows of green dots. (Again, we take one due to fence posts and fence panels.)

Of these green dots, half are in the triangle of interest, so:

$$\text{Corners visited twice} = \frac12\left(\frac{\mathrm{lcm}(m-1,n-1)}{m-1}-1\right)\left(\frac{\mathrm{lcm}(m-1,n-1)}{n-1}-1\right)$$
### Putting it together

We can now put the two parts together to get:

$$\text{Distinct corners visited} = \mathrm{lcm}(m-1,n-1)+1 - \frac12\left(\frac{\mathrm{lcm}(m-1,n-1)}{m-1}-1\right)\left(\frac{\mathrm{lcm}(m-1,n-1)}{n-1}-1\right)$$
And we have solved the problem.

#### Example

For the \(4\times6\) rectangle given, our formula gives:

$$\text{Distinct corners visited} = \mathrm{lcm}(3,5)+1 - \frac12\left(\frac{\mathrm{lcm}(3,5)}{3}-1\right)\left(\frac{\mathrm{lcm}(3,5)}{5}-1\right)$$
$$= 15+1 - \frac12(5-1)(3-1)$$
$$= 16 - 4 = 12$$
This is correct:

### Disproving the Conjecture

In Gaurish's most recent post, he gave the following
conjecture:
The highest common factor (or greatest common divisor) of \(m\) and \(n\) always divides the number of coloured squares.

After trying to prove this for a while, I found that me attempted proof
required that \(\mathrm{hcf}(n-1,m-1)^2-1\) is a multiple of \(\mathrm{hcf}(n,m)\).
However this is not in general true (eg. 15,5).

In fact, 15,5 provides us with a counterexample to the conjecture:

In this diagram, 26 squares are coloured. However \(\mathrm{hcf}(15,5)=5\)
and 5 is not a factor of 26.

### Similar Posts

Christmas (2016) is Over | Christmas Card 2016 | Christmas (2016) is Coming! | The Mathematical Games of Martin Gardner |

### Comments

Comments in green were written by me. Comments in blue were not written by me.

**Add a Comment**

**2016-03-15**

## The Mathematical Games of Martin Gardner

This article first appeared in
issue 03 of

*Chalkdust*. I highly recommend reading the rest of the magazine (and trying to solve the crossnumber I wrote for the issue).It all began in December 1956, when an article about hexaflexagons was published in

*Scientific American*. A hexaflexagon is a hexagonal paper toy which can be folded and then opened out to reveal hidden faces. If you have never made a hexaflexagon, then you should stop reading and make one right now. Once you've done so, you will understand why the article led to a craze in New York; you will probably even create your own mini-craze because you will just*need*to show it to everyone you know.The author of the article was, of course, Martin Gardner.

Martin Gardner was born in 1914 and grew up in Tulsa, Oklahoma. He earned a bachelor's degree in philosophy from the University of Chicago and
after four years serving in the US Navy during the Second World War, he returned to Chicago and began writing. After a few years working on
children's magazines and the occasional article for adults, Gardner was introduced to John Tukey, one of the students who had been involved in
the creation of hexaflexagons.

Soon after the impact of the hexaflexagons article became clear, Gardner was asked if he had enough material to maintain a monthly column.
This column,

*Mathematical Games*, was written by Gardner every month from January 1956 for 26 years until December 1981. Throughout its run, the column introduced the world to a great number of mathematical ideas, including Penrose tiling, the Game of Life, public key encryption, the art of MC Escher, polyominoes and a matchbox machine learning robot called MENACE.### Life

Gardner regularly received topics for the column directly from their inventors. His collaborators included Roger Penrose, Raymond Smullyan,
Douglas Hofstadter, John Conway and many, many others. His closeness to researchers allowed him to write about ideas that
the general public were previously unaware of and share newly researched ideas with the world.

In 1970, for example, John Conway invented the Game of Life, often simply referred to as Life. A few weeks later, Conway showed the game to Gardner, allowing
him to write the first ever article about the now-popular game.

In Life, cells on a square lattice are either alive (black) or dead (white). The status of the cells in the next generation of the game is given by the following
three rules:

- Any live cell with one or no live neighbours dies of loneliness;
- Any live cell with four or more live neighbours dies of overcrowding;
- Any dead cell with exactly three live neighbours becomes alive.

For example, here is a starting configuration and its next two generations:

The collection of blocks on the right of this game is called a

*glider*, as it will glide to the right and upwards as the generations advance. If we start Life with a single glider, then the glider will glide across the board forever, always covering five squares: this starting position will not lead to the sad ending where everything is dead. It is not obvious, however, whether there is a starting configuration that will lead the number of occupied squares to increase without bound.Originally, Conway and Gardner thought that this was impossible, but after the article was published, a reader and mathematician called Bill Gosper
discovered the glider gun: a starting arrangement in Life that fires a glider every 30 generations. As each of these gliders will go on to live
forever, this starting configuration results in the number of live cells
perpetually increasing!

This discovery allowed Conway to prove that any Turing machine can be built within Life: starting
arrangements exist that can calculate the digits of pi, solve equations, or do any other calculation a computer is capable of (although very slowly)!

#### Encrypting with RSA

To encode the message \(809$, we will use the public key:

$$s=19\quad\text{and}\quad r=1769$$
The encoded message is the remainder when the message to the power of \(s\) is divided by \(r$:

$$809^{19}\equiv\mathbf{388}\mod1769$$
#### Decrypting with RSA

To decode the message, we need the two prime factors of \(r\) (\(29\) and \(61\)).
We multiply one less than each of these together:

\begin{align*}
a&=(29-1)\times(61-1)\\[-2pt]
&=1680.
\end{align*}
We now need to find a number \(t\) such that \(st\equiv1\mod a\). Or in other words:

$$19t\equiv1\mod 1680$$
One solution of this equation is \(t=619\) (calculated via the

*extended Euclidean algorithm*).Then we calculate the remainder when the encoded message to the power of \(t\) is divided by \(r\):

$$388^{619}\equiv\mathbf{809}\mod1769$$
### RSA

Another concept that made it into

*Mathematical Games*shortly after its discovery was public key cryptography. In mid-1977, mathematicians Ron Rivest, Adi Shamir and Leonard Adleman invented the method of encryption now known as RSA (the initials of their surnames). Here, messages are encoded using two publicly shared numbers, or keys. These numbers and the method used to encrypt messages can be publicly shared as knowing this information does not reveal how to decrypt the message. Rather, decryption of the message requires knowing the prime factors of one of the keys. If this key is the product of two very large prime numbers, then this is a very difficult task.### Something to think about

Gardner had no education in maths beyond high school, and at times had difficulty understanding the material he was writing about. He believed, however, that this was a strength and not a weakness: his struggle to understand led him to write in a way that other non-mathematicians could follow. This goes a long way to explaining the popularity of his column.

After Gardner finished working on the column, it was continued by Douglas Hofstadter and then AK Dewney before being passed down to Ian Stewart.

Gardner died in May 2010, leaving behind hundreds of books and articles. There could be no better way to end than with something for you to go
away and think about. These of course all come from Martin Gardner's

*Mathematical Games*:- Find a number base other than 10 in which 121 is a perfect square.
- Why do mirrors reverse left and right, but not up and down?
- Every square of a 5-by-5 chessboard is occupied by a knight.
- Is it possible for all 25 knights to move simultaneously in such a way that at the finish all cells are still occupied as before?

### Similar Posts

MENACE | Dragon Curves II | Making Names in Life | Optimal Pac-Man |

### Comments

Comments in green were written by me. Comments in blue were not written by me.

**Add a Comment**

2017-02-03