## Teaser 2948: A hardy annual

**From The Sunday Times, 24th March 2019** [link]

Yesterday was my grandson’s birthday and we continued a family tradition. I asked him to use any eight different non-zero digits (once each) to form a set of numbers that added to 2019. Last year I asked the equivalent question with a sum of 2018, and I have done this each year for over ten years. Only on one occasion has he been unable to complete the task.

In this year’s answer his set of numbers included a 3-figure prime that had also featured in last year’s numbers.

(a) In which year was he unable to complete the task?

(b) What was the 3-figure prime that featured in this year’s answer?

[teaser2948]

## Jim Randell 7:48 am

on24 March 2019 Permalink |I assumed the numbers are formed only by concatenation of digits, and not any other method.

This Python program considers the number of digits present in each column of the sum to construct viable solutions.

It runs in 84ms.

Run:[ @repl.it ]Solution:(a) 2015. (b) 523.LikeLike

## Jim Randell 8:30 am

on31 March 2019 Permalink |There are 9 different ways we can construct the sum to potentially give a 4-digit result.

Counting the number of digits in each of the columns of the sum (<thousands>, <hundreds>, <tens>, <ones>), we have:

However, for years in the range 2009 to 2019 we only need to consider the constructions that have a single 4-digit number, i.e.:

It turns out there are 132 sets of numbers that can be made that sum to 2019. And 114 that sum to 2018.

We can compute the number of solutions for various years as follows:

Using digital roots we can see that the missing digit in the sum for year

nis:So every 9 years (when the year has remainder of 8 when divided by 9), we get a year that has no solutions, as it is not possible to make a year after 1889 without using the digit 1, until we get to 2375. The years we are considering fall within this range, and so there is one year in the required range can have no solutions. This provides the answer to the first part of puzzle.

The possible solutions for the year 2018 are (with the solutions involving 3 digit numbers indicated (*)):

The digits are grouped into columns, so the first number is made by choosing one digit from each of the groups, e.g. 1324, then the second number is made by choosing from the remaining digits, e.g. 685, and the next number is formed from the remaining digits, in this case 9. This exhausts all the digits, so: 1324 + 685 + 9 = 2018.

In this way we see the possible 3-digit numbers involved are:

and the only ones that are prime are 389 and 523.

For 2019 the corresponding solutions are:

So the 3-digit prime needs to match:

And the only one of our candidates that matches is 523.

So we have:

missing out the digit 7.

And:

missing out the digit 6.

This provides the answer to the second part of the puzzle.

LikeLike