mscroggs.co.uk
mscroggs.co.uk

subscribe

Blog

 2023-01-08 
Welcome to 2023 everyone! Now that the Advent calendar has disappeared, it's time to reveal the answers and announce the winners. But first, some good news: with your help, the drones were all destroyed in time for Santa to deliver presents and Christmas was saved!
Now that the competition is over, the questions and all the answers can be found here. Before announcing the winners, I'm going to go through some of my favourite puzzles from the calendar and a couple of other interesting bits and pieces.

Highlights

My first highlight is the puzzle from 1 December. I like this puzzle, because the lines of symmetry of a rectangle that you might expect—although it's not too hard to see what the lines of symmetry are, so this makes a nice gentle first puzzle.

1 December

One of the vertices of a rectangle is at the point \((9, 0)\). The \(x\)-axis and \(y\)-axis are both lines of symmetry of the rectangle.
What is the area of the rectangle?

Show answer


My next hightlight is the puzzle from 11 December. I always enjoy a surprise appearance of the Fibonacci sequence.

11 December

There are five 3-digit numbers whose digits are all either 1 or 2 and who do not contain two 2s in a row: 111, 112, 121, 211, and 212.
How many 14-digit numbers are there whose digits are all either 1 or 2 and who do not contain two 2s in a row?

Show answer


My next highlight is the puzzle from 13 December. I love a good crossnumber, and had a lot of fun making this small one up. (If you enjoyed this one, you should check out the crossnumbers I write for Chalkdust.)

13 December

Today's number is given in this crossnumber. The across clues are given as normal, but the down clues are given in a random order: you must work out which clue goes with each down entry and solve the crossnumber to find today's number. No number in the completed grid starts with 0.

Show answer


My final highlight is the puzzle from 24 December. You could solve this by doing a lot of expanding, but there's a neat shortcut that makes it almost trivial to solve.

24 December

The expression \((3x-1)^2\) can be expanded to give \(9x^2-6x+1\). The sum of the coefficients in this expansion is \(9-6+1=4\).
What is the sum of the coefficients in the expansion of \((3x-1)^7\)?

Show answer

Hardest and easiest puzzles

Once you've entered 24 answers, the calendar checks these and tells you how many are correct. I logged the answers that were sent for checking and have looked at these to see which puzzles were the most and least commonly incorrect. The bar chart below shows the total number of incorrect attempts at each question.
You can see that the most difficult puzzles were those on 11, 18 and 19 December; and the easiest puzzle was on 8 December.

The winners

And finally (and maybe most importantly), on to the winners: 192 people managed to destroy all three drones. That's more people than last year:
From the correct answers, the following 10 winners were selected:
Congratulations! Your prizes will be on their way shortly.
The prizes this year include 2022 Advent calendar T-shirts. If you didn't win one, but would like one of these, I've made them available to buy at merch.mscroggs.co.uk alongside the T-shirts from previous years.
Additionally, well done to Aaron Johnson, Aaron Stiff, Aidan Dodgson, Alejandro Villarreal, Alek2ander, Alex Bolton, Alex Davis, Alex Hartz, Andrew Brady, Andrew Brodie, Andrew Ennaco, Andrew Roy, Andrew Turner, Artie Smith, Ashton Lewis, Austin Antoniou, Becky Russell, Ben Baker, Ben Boxall, Ben Reiniger, Ben Tozer, Ben Weiss, Beth Jensen, Blake, Brennan Dolson, Brian Carnes, Brian Wellington, Carl Westerlund, Carmen, Charleston W, Chris Eagle, Chris Hellings, Colin Beveridge, Colin Brockley, Connie, Corbin Groothuis, CreativeCrocheter, Dan Colestock, Dan DiMillo, Dan May, Dan Swenson, Dan Whitman, Daniel Cuneo, David and Ivy Walbert, David Ault, David Berardo, David Fox, David Kendel, David Mitchell, Deborah Tayler, Deborah Tayler, Derek Perrin, Dominik Niemand, Don Anderson, Dr Lizzie, Duncan Schaafsma, Dylan Richard, Eleanor, Elizabeth Blackwell, Elizabeth Madisetti, Emilie Heidenreich, Emily Troyer, Emma, Eoin Davey, Eric Kolbusz, Eric Scotti, Erik Eklund, Fionn Woodcock, Frances, Frank Kasell, Fred Verheul, Freddie Mao, Félix Breton, Gabriella Pinter, Gary M. Gerken, Gerry, Gert-Jan, Greg W., Gregory Loges, Greta, Han Whiteoak, Hannah Charman, Heerpal Sahota, Helen F, Herschel, Iris, Jack, Jacob, Jacob Loader, James Chapman, James Cunnane, Jarvis9, Jean-Noël Monette, Jean-Sébastien Turcotte, Jen Sparks, Jessica Marsh, Jim Ashworth, Jon Palin, Jonathan Chaffer, Jonathan Thiele, Jorge del Castillo Tierz, Joseph Gage, Joseph Wagner, Joshua Park, Karen Climis, Kevin Docherty, Kirsty Fish, Kristen Koenigs, Kyle Allen, Lazar Ilic, Lewis Dyer, Lise Andreasen, Louis, LycanFayn, Lyra, Magnus Eklund, Marco van der Park, Mark Stambaugh, Martin Harris, Martin Holtham, Mathryn, Matt Thomson, Mels, Merrilyn, Michael DeLyser, Mihai Zsisku, Mike L, Mike R, Millie, Mr J Winfield, Nadine Chaurand, Nancy Walker, Naomi Bowler, Naomi C, Nick Keith, Niji Ranger, Pamela Docherty, Patrick, Philip Corradi, Priyesh, Pup, Qaysed, Qaysed, Rashi, Ray Arndorfer, Reid, Reuben, Riccardo Lani, Rob Dixon, Robert Brady, Roger Lipsett, Roni Malek, Rosie Paterson, Russ Collins, Ruth Franklin, Sage Robinson, Sam Drei, Sarah Brook, Scott, Sean Henderson, Seth Cohen, shadorfff, Simon English, Stephen Cappella, Stephen Jasina, Sumaya Felic, Tamara Brenner, Tarim, The Connors of York, The Steelblade, Tom Fryers, Tony Mann, tripleboleo, Tyler St Clare, UsrBinPRL, Valentin VĂLCIU, Vinayak, Vinny R, vortex, Yasha, Yuliya N., and Zoran Morrissey-Ralevic. who all also completed the Advent calendar but were too unlucky to win prizes this time or chose to not enter the prize draw.
See you all next December, when the Advent calendar will return.
Edit: Removed myself (and a second copy of myself) from the list of solvers.
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
You didn't mention the rate limiting you put in for the bots!

Sorry about that
(anonymous)
      ×1           Reply
I fought very hard to solve the middle "here are the 6 answers, construct the 6 small problems", but I just couldn't. Hints about that one and the genre in general would be great.
Lise Andreasen
                 Reply
@Valentin V?LCIU: Oops, forgot to remove my testing that everything works from the list of people! (Removing it now)
Matthew
                 Reply
You solved your own problems? Twice?
Valentin V?LCIU
      ×1      ×1     Reply
@(anonymous): There was a typo - I've just corrected it
Matthew
                 Reply
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "tnemges" backwards in the box below (case sensitive):
 2022-12-29 
This is the 100th blog post on this website!
But if I hadn't pointed this out, you might not have noticed: the URL of the page is mscroggs.co.uk/blog/99 and not mscroggs.co.uk/blog/100. This is a great example of an off-by-one error.
Off-by-one errors are one of the most common errors made when programming and elsewhere, and this is an excellent opportunity to blog about them.

Fence posts and fence panels

Imagine you want to make a straight fence that is 50m long. Each fencing panel is 2m long. How many fence posts will you need?
Have a quick think about this before reading on.
If you're currently thinking about the number 25, then you've just made an off-by-one error. The easiest way to see why is to think about some shorter fences.
If you want to make a fence that's 2m long, then you'll need just one fence panel. But one fence post will not be enough: you'll need a second post to put at the other end of the fence panel.
If you want to make a 4m long fence, you'll need a post before the first panel, a post between the two panels, and a post after the second panel: that's three posts in total.
In general, you'll always need one more fence post than panel, as you need a fence post at the start of each panel and an extra post at the end of the final panel. (Unless, of course, you're building a fence that is a closed loop.)
This fence has 4 fence panels but 5 fence posts
This fence post/fence panel issue appears surprisingly often, and can make counting things quite difficult. For example, the first blog post on this website was posted in 2012: ten years ago. But if you count the number of years listed in the archive there are 11 years. If you release an issue of a magazine once a year, then issue 11 (not issue 10) will be the issue released 10 years after you start not issue 10. If, like Chalkdust, you release issues two times a year, issue 21 (not issue 20) will be the 10 year issue.

Half-open intervals

An interval is called closed if it includes its starting and ending point, and open if it doesn't include them. A half-open interval includes one end point and not the other. Using half-open intervals makes counting things less difficult: including one endpoint but not the other is a bit like ignoring the final (or first) fence post so that there are the same number of post and panels.
In Python, the range function includes the first number but not the last (this is the sensible choice as including the final number and not the first would be very confusing). range(5, 8) includes the numbers 5, 6, and 7 (but not 8). By excluding the final number, the number of numbers in a range will be equal to the difference between the two input numbers.
Excluding the final item so that the number of items in a range is equal to the difference between the start and end is a great way to reduce opportunities for off-by-one errors, and isn't too hard to get used to.

Why start at 0?

We've seen a couple of causes of off-by-one errors, but we've not yet seen why this page's URL contains 99 rather than 100. This is because the numbering of blog posts started at zero. But why is it a sensible choice to start at 0?
Using a half-open range, the first \(n\) numbers starting at 1 would be range(1, n + 1); the first \(n\) numbers starting at 0 on the other hand would be range(0, n). The second option is neater, as you don't have to add one to the final number; the first option opens up more opportunities for off-by-one errors. This is one of the reasons why Python and many other programming languages start their numbering from 0.

Why doesn't everyone start at 0?

Starting at 0 and using half-open intervals to represent ranges of integers seem like good ways to help people avoid making off-by-one errors, but this choice is not perfect. If you want to write a range of numbers from 1 to 8 inclusive using this convention, you would have to write range(1, 9): forgetting to add one to the final number in this situation is another source of off-by-one errors.
It's also more natural to many people to start counting from 1, so some programming languages choose different conventions. The following table sums up the different possible conventions, which desirable properties they have, and which languages use them.
Convenction Languages using this convention Length of range is difference between endpoints range(START, n) contains \(n\) numbers range(START, n) contains START range(START, n) contains \(n\)
START=0, range includes first endpoint onlyPython, Javascript, PHP, Rust, C, C++
START=0, range includes last endpoint only
START=0, range includes both endpoints
START=0, range includes neither endpoint
START=1, range includes first endpoint only
START=1, range includes last endpoint only
START=1, range includes both endpointsMatlab, Julia, Fortran
START=1, range includes neither endpoint
(I don't know of any languages that use any of the other conventions, but if you have please let me know in the comments below and I'll add them.)
None of the conventions manages to remove all the possible sources of confusion, so it looks like off-by-one errors are here to stay.
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
Hi!!!
Love your blog posts!
They make me get out of bed in the morning.
Just wanted to show my appreciation.
Cheers.
Anonymous#3728
×1                 Reply
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "hexagon" in the box below (case sensitive):
 2022-12-04 
In November, I spent some time (with help from TD) designing this year's Chalkdust puzzle Christmas card.
The card looks boring at first glance, but contains 11 puzzles. By colouring in the answers to the puzzles on the front of the card in black (each answer appears twice), then colouring remaining squares containing 0s red, and regions containing a star brown, you will reveal a Christmas themed picture.
If you want to try the card yourself, you can download this printable A4 pdf. Alternatively, you can find the puzzles below and type the answers in the boxes. The answers will automatically be found and coloured in black, and appropriate squares and regions will be coloured red and brown...
4 5 6 2 8 2 3 6 7 2 4 2 7 0 9 8 4 4 8 9 7 2 4 7 2 9 7 6 7 3 8 9 6 2 3 9 6 3 0 2 2 6 2 8 8 4 2 2 9 0 4 4 8 2 9 9 7 4 8 7 9 7 3 3 2 6 9 3 0 8 3 8 9 9 6 9 3 0 7 9 6 9 3 2 2 6 7 6 9 6 8 0 9 9 2 6 8 2 8 8 8 7 9 3 7 6 2 9 3 7 5 3 9 1 8 3 2 8 2 2 6 2 2 7 2 8 7 6 7 9 8 8 1 9 9 3 2 7 3 9 3 6 9 2 8 6 9 7 4 2 6 2 6 3 8 9 9 6 0 0 9 3 8 9 3 6 8 3 7 9 0 0 6 8 8 9 8
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
@Nicki: If you're correct the picture should look suitably Christmassy
Matthew
   ×1              Reply
Where can I find out if I am correct?
Nicki
                 Reply
@Graeme Johnston: If you're right the picture should look suitably Christmassy
Matthew
                 Reply
Great fun thanks. At first they seem impossible but then a way through appears! How do I get the answers / check if I’m right?
Graeme Johnston
                 Reply
@Mike: The final picture doesn't have to be symmetric
Matthew
   ×2      ×1        Reply
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "v" then "e" then "c" then "t" then "o" then "r" in the box below (case sensitive):
 2022-11-25 
This year, the front page of mscroggs.co.uk will once again feature an Advent calendar, just like in each of the last seven years. Behind each door, there will be a puzzle with a three digit solution. The solution to each day's puzzle forms part of a logic puzzle:
It's nearly Christmas and something terrible has happened: an evil Christmas-hater has set three drones loose above Santa's stables. As long as the drones are flying around, Santa is unable to take off to deliver presents to children all over the world. You need to help Santa by destroying the drones so that he can deliver presents before Christmas is ruined for everyone.
Each of the three drones was programmed with four integers between 1 and 20 (inclusive): the first two of these are the drone's starting position; the last two give the drone's daily speed. The drones have divided the sky above Santa's stables into a 20 by 20 grid. On 1 December, the drones will be at their starting position. Each day, every drone will add the first number in their daily speed to their horizontal position, and the second number to their vertical position. If the drone's position in either direction becomes greater than 20, the drone will subtract 20 from their position in that direction. Midnight in Santa's special Advent timezone is at 5am GMT, and so the day will change and the drones will all move at 5am GMT. For example, if a drone's starting position was (1, 12) and its movement was (5, 7), then:
You need to calculate each drone's starting position and daily speed, then work out where the drone currently is so you can shoot it down.
Behind each day (except Christmas Day), there is a puzzle with a three-digit answer. Each of these answers forms part of a piece of information about the locations of the drones. You must use these clues to work out each drone's starting position and daily speed, then work out where the drone currently is so you can shoot it down.
You can use this page to fire up to 5 missiles into the sky each day.
Ten randomly selected people who solve all the puzzles, destroy all three drones, and fill in the entry form behind the door on the 25th will win prizes!
The prizes will include an mscroggs.co.uk Advent 2022 T-shirt. If you'd like one of the T-shirts from a previous Advent, they are available to order at merch.mscroggs.co.uk.
The winners will be randomly chosen from all those who submit the entry form before the end of 2022. Each day's puzzle (and the entry form on Christmas Day) will be available from 5:00am GMT. But as the winners will be selected randomly, there's no need to get up at 5am on Christmas Day to enter!
As you solve the puzzles, your answers will be stored. To share your stored answers between multiple devices, enter your email address below the calendar and you will be emailed a magic link to visit on your other devices.
To win a prize, you must submit your entry before the end of 2022. Only one entry will be accepted per person. If you have any questions, ask them in the comments below, on Twitter, or on Mastodon.
So once December is here, get solving! Good luck and have a very merry Christmas!
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
My dad and I did several of these puzzles together. I am 8 years old, and I figured many of them out. Thank you!
Xena
×4   ×2         ×1     Reply
It's becoming a Christmas tradition to do your advent calendar with my partner. Loved being able to narrow down our guesses each day to pinpoint the drone this time around. Thanks for running this!
Liz
×1                 Reply
Another year of great puzzles, Matt! I really appreciate it and look forward to working these every year.
Dan Whitman
×2                 Reply
Loads of fun for our family, thanks!
Stephen
×1                 Reply
Really enjoyable this year. I "give" this advent calendar to my Year 12 and 13 Further Maths classes every year, and this has engaged more of them than in previous years. They particularly liked the shooting down of drones and the opportunity for intelligent "guess work" or in the case of some writing a computer programme which would calculate the probability distribution for each drone's position based on current information. Thank you
TAS
×5            ×1     Reply
Thanks so much for making this, Matthew! It was a joy to solve, I found myself looking forward to every morning.
Tyler St Clare
×1   ×1      ×1        Reply
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "x-axis" in the box below (case sensitive):
 2022-10-27 
It's a while since I've put a new blog post here. This is partly because I've been busy working on other exciting maths projects. One of these exciting projects is happening tomorrow: the 24 Hour Maths Game Show.
Two years ago, I helped run the 24 Hour Maths Magic Show. Two years on, we've decided to do it again, but this time the show will feature 24 hours of content about games, including mathematical game shows, game theory, board games, and video games. The full schedule for the show is at 24hourmaths.com/gameshow, and you can watch it for free on YouTube. If for some reason you want to just watch the bits featuring me, I'll be on the show doing the following (all times in BST/UTC+1):
I'd recommend watching as much of the show as you can; the whole thing is going to be amazing. A recording of the whole thing will be available afterwards if you can't stay away for the whole lot. The show is raising money for four excellent charities, so throw some money their way if you enjoy the show.
After you've watched the show, keep an eye out for the next issue of Chalkdust, which is due out in the next few weeks. And it's not long until there'll be a post here about this year's Advent calendar...
Edit: Added links to watch recordings of each segment.
                        
(Click on one of these icons to react to this blog post)

You might also enjoy...

Comments

Comments in green were written by me. Comments in blue were not written by me.
 Add a Comment 


I will only use your email address to reply to your comment (if a reply is needed).

Allowed HTML tags: <br> <a> <small> <b> <i> <s> <sup> <sub> <u> <spoiler> <ul> <ol> <li> <logo>
To prove you are not a spam bot, please type "integer" in the box below (case sensitive):

Archive

Show me a random blog post
 2024 

Feb 2024

Zines, pt. 2

Jan 2024

Christmas (2023) is over
 2023 
▼ show ▼
 2022 
▼ show ▼
 2021 
▼ show ▼
 2020 
▼ show ▼
 2019 
▼ show ▼
 2018 
▼ show ▼
 2017 
▼ show ▼
 2016 
▼ show ▼
 2015 
▼ show ▼
 2014 
▼ show ▼
 2013 
▼ show ▼
 2012 
▼ show ▼

Tags

zines chebyshev convergence propositional calculus manchester mathsjam sobolev spaces electromagnetic field simultaneous equations programming hexapawn captain scarlet martin gardner big internet math-off latex estimation pythagoras chalkdust magazine advent calendar graphs geogebra manchester science festival royal baby finite group newcastle ucl dragon curves gather town folding paper datasaurus dozen exponential growth curvature matrices boundary element methods tmip radio 4 youtube speed logic guest posts squares light games golden spiral 24 hour maths pi rhombicuboctahedron inverse matrices world cup binary palindromes sport menace pascal's triangle mathsteroids accuracy mathslogicbot preconditioning hyperbolic surfaces signorini conditions computational complexity matrix of cofactors correlation polynomials finite element method standard deviation data visualisation game of life gaussian elimination talking maths in public pizza cutting asteroids inline code crossnumber error bars reuleaux polygons edinburgh sound hannah fry people maths flexagons matrix multiplication dates pi approximation day go chess map projections mean raspberry pi interpolation approximation logs cross stitch football hats golden ratio craft rugby a gamut of games weak imposition pac-man phd matt parker anscombe's quartet draughts statistics countdown numbers triangles national lottery books stirling numbers live stream cambridge runge's phenomenon trigonometry bempp christmas misleading statistics news matrix of minors bubble bobble determinants crochet arithmetic ternary wave scattering stickers game show probability logo plastic ratio braiding realhats fonts royal institution platonic solids noughts and crosses dataset fractals probability puzzles sorting recursion php numerical analysis turtles london underground frobel gerry anderson video games data dinosaurs european cup bodmas reddit the aperiodical weather station graph theory databet javascript final fantasy coins wool tennis oeis python christmas card harriss spiral fence posts errors geometry london folding tube maps nine men's morris machine learning quadrilaterals

Archive

Show me a random blog post
▼ show ▼
© Matthew Scroggs 2012–2024