## BBC puzzle

malkymoo
2 Lemon pips
Posts: 173
Joined: November 23rd, 2016, 9:45 am
Has thanked: 10 times
Been thanked: 28 times

### BBC puzzle

There was a puzzle set a while ago on the "Today" programme which I have been unable to fathom. The puzzle is:

If each letter represents a single digit how many solutions are there to the sum:

BBC + NEWS = JOHN ?

The puzzle is here: http://www.bbc.co.uk/programmes/article ... -for-today, and an answer is provided, but no explanation as to how it is arrived at.

The puzzles set on the programme are normally not difficult, and I think maybe I am missing something obvious. Any ideas?

HBEN
Posts: 39
Joined: May 25th, 2017, 10:46 am
Has thanked: 4 times
Been thanked: 1 time

### Re: BBC puzzle

I tried, didn't ring any bell in my head. I'd want an explanation too!

JamesMuenchen
Lemon Slice
Posts: 255
Joined: November 4th, 2016, 9:05 pm
Has thanked: 29 times
Been thanked: 34 times

### Re: BBC puzzle

I rewrote it in this format:
NEWS
+ BBC
-------
JOHN

It seemed to make a few things more obvious for me...

N,B and J can't be 0s as they are leading

There must be a carry-1 in column 4

So J must be > 1

S and C can't be 0 or their addition wouldn't result in N

Then I got annoyed and wrote a python script

Code: Select all

`from itertools import permutationsresults=0for i in permutations('0123456789'):    str = ''.join(i)    [N,E,W,S,B,C,J,O,H,Z]=list(str)    if int(N+E+W+S)+int(B+B+C)==int(J+O+H+N) :       if int(J) != 0 and int(B) !=0 and int(N) != 0 :          results=results+1print(results)`

result is 96 possible solutions

I also hope someone has a real explanation

Gengulphus
Lemon Quarter
Posts: 2532
Joined: November 4th, 2016, 1:17 am
Been thanked: 1175 times

### Re: BBC puzzle

Well, I can see how it could be done by hand, but all methods I've seen would be a lot of error-prone work - not absolutely prohibitive, but definitely a major project rather than what one might normally devote to a puzzle. An outline of the best method I've seen is:

* Consider S and C. Any particular pair of values for them implies values for N and J: N is equal to (S+C) MOD 10, and J must be N+1 (otherwise JOHN-NEWS =BBC would have more than three digits. Neither S nor C can be 0, otherwise N is equal to the other, nor can either of them be 9, otherwise N is equal to 9 or to the other minus 1, implying that J is equal to 10 or the other. So we have 8*7 = 56 possible choices for (S,C), and furthermore any solution remains a solution if we swap S and C. So half the solutions have S < C and the other half can be found by swapping S and C in those solutions. That leaves us with 28 (S,C) pairs to investigate: of those, the ones with S+C = 9 or 10 can be eliminated, as they imply N = 9 or 0 respectively and N=9 implies J=10 while N=0 would be a leading zero. That eliminates (S,C) = (1,8), (2,7), (3,6), (4,5), (2,8), (3,7) and (4,6), leaving 21 possibilities for (S,C). Calculating N and J for each of them gives 21 possibilities for (S,C,N,J), all of which have the four digits all different and nonzero, so are real possibilities on what we've considered so far.

* Next consider B and W. B cannot be any of S, C, N, J or zero (because the last would be a leading zero), so there are five possibilities for B, and for each of them, W cannot be any of S, C, N, J or B, so there are 5 possibilities for W. So we have 21*5*5 = 525 possibilities for (S,C,N,J,W,B), each of which allows us to calculate H as the tens digit of BC+WS. Eliminating those cases where H is equal to one of S, C, N, J, W or B leaves 176 possibilities for (S,C,N,J,W,B,H). This is the first major bit of work doing it by hand - I cheated and did it by spreadsheet!

* Each of those possibilities leaves just three digits available out of which to pick E and O. Furthermore, we know that O < E, since otherwise JOHN-NEWS = BBC would have more than three digits, so there are just three ways to pick E and O, as (smallest,middle), (smallest,largest) or (middle,largest) of those three remaining digits. That gives 3*176 = 528 possibilities for (S,C,N,J,W,B,H,E,O), each of which can be checked to see whether it's a solution. This is the second major bit of work (I again cheated) and 96 of them turn out to be solutions.

I've done some investigations of the 96 solutions to see whether I can spot any evidence of any sort of structured pattern to them that might lead to a significantly easier attack on the puzzle. I can't, though whether that's because there isn't such a pattern or because I'm not good enough at spotting it is of course open to question...

Gengulphus

Gengulphus
Lemon Quarter
Posts: 2532
Joined: November 4th, 2016, 1:17 am
Been thanked: 1175 times

### Re: BBC puzzle

Minor correction:

Gengulphus wrote:* Each of those possibilities leaves just three digits available out of which to pick E and O. Furthermore, we know that O < E, since otherwise JOHN-NEWS = BBC would have more than three digits, so there are just three ways to pick E and O, as (smallest,middle), (smallest,largest) or (middle,largest) of those three remaining digits. That gives 3*176 = 528 possibilities for (S,C,N,J,W,B,H,E,O), each of which can be checked to see whether it's a solution. This is the second major bit of work (I again cheated) and 96 of them turn out to be solutions.

That should instead end "... and 48 of them turn out to be solutions, leading to 96 solutions after adding those with S and C swapped."

Gengulphus

malkymoo
2 Lemon pips
Posts: 173
Joined: November 23rd, 2016, 9:45 am
Has thanked: 10 times
Been thanked: 28 times

### Re: BBC puzzle

Thank you for the two methods provided. I hope you both found it entertaining! It did confirm that there was no easy solution that a bit of intuition might provide. I suspected that, but unlike you I did not have the persistence to try more labour-intensive methods.

I had not encountered Python before, it looks like a very powerful tool. Just out of interest, how long did it take to run your script?

JamesMuenchen
Lemon Slice
Posts: 255
Joined: November 4th, 2016, 9:05 pm
Has thanked: 29 times
Been thanked: 34 times

### Re: BBC puzzle

It runs in about 15 seconds on my laptop

cinelli
2 Lemon pips
Posts: 169
Joined: November 9th, 2016, 11:33 am
Has thanked: 42 times
Been thanked: 23 times

### Re: BBC puzzle

JamesMuenchen wrote:It runs in about 15 seconds on my laptop

On my 14 year old IBM Thinkpad T23 (about which I have occasionally written on the computing board) it took 100 seconds running in linux. But the program worked first time with no changes whatsoever, which in my experience is a very rare occurrence. Thank you JamesMuenchen.

Cinelli