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?
Got a credit card? use our Credit Card & Finance Calculators
Thanks to eyeball08,Wondergirly,bofh,johnstevens77,Bhoddhisatva, for Donating to support the site
BBC puzzle
-
- Lemon Slice
- Posts: 668
- Joined: November 4th, 2016, 9:05 pm
- Has thanked: 141 times
- Been thanked: 167 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
result is 96 possible solutions
I also hope someone has a real explanation
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 permutations
results=0
for 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+1
print(results)
result is 96 possible solutions
I also hope someone has a real explanation
-
- Lemon Quarter
- Posts: 4255
- Joined: November 4th, 2016, 1:17 am
- Been thanked: 2628 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
* 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
-
- Lemon Quarter
- Posts: 4255
- Joined: November 4th, 2016, 1:17 am
- Been thanked: 2628 times
Re: BBC puzzle
Minor correction:
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
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
-
- Lemon Slice
- Posts: 351
- Joined: November 23rd, 2016, 9:45 am
- Has thanked: 29 times
- Been thanked: 117 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?
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?
-
- Lemon Slice
- Posts: 668
- Joined: November 4th, 2016, 9:05 pm
- Has thanked: 141 times
- Been thanked: 167 times
-
- Lemon Slice
- Posts: 553
- Joined: November 9th, 2016, 11:33 am
- Has thanked: 234 times
- Been thanked: 161 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
Return to “Games, Puzzles and Riddles”
Who is online
Users browsing this forum: No registered users and 30 guests