# Sunday Times Teaser 2783 – Old Boys’ Banquet

*by Danny Roth*

#### Published: 24 January 2016 (link)

George and Martha have arranged the seating plan for the annual Old Boys banquet; it involves a number of tables, each seating 50 diners. More than half the Old Boys are bringing one female guest each and the rest are coming alone. Martha wrote down three numbers, namely the number of Old Boys bringing a guest, the number of Old Boys coming alone, and the total number of Old Boys coming. George noted that the three numbers between them used each of the digits 0 to 9 exactly once.

How many Old Boys are bringing a guest, and how many are coming alone?

5 Comments
Leave one →

A bit of analysis provides a much faster solution:

Using the code below I seems to get two valid answers

Welcome to the site Kevin! You are right that this teaser has multiple solutions (four in fact) but there is a problem somewhere in your code since neither of your solutions is correct – the three numbers involve duplicate digits: 732 + 486 = 1218 and 793 + 264 = 1057. It seems that your Total includes the girls but the total that is needed in finding the ten digits is the total number of boys.

I am guessing that you are fairly new to Python and, perhaps, more used to coding in C? Once you get to grips with Python you will find that it has many nice features!

By the way, to get your code formatted you need to add tags (see the menu item ‘About’ above).

Here’s a solution that uses the SubstitutedSum() solver from the

enigma.pyI took a short cut using Brian’s letter/number substitution Python program on his ‘paper and pencil’ teaser site. If \(efg\), \(hij\) and \(abcd\) are the number of boys with and without partners and the total respectively, then: \(efg + hij = abcd\) where \(efg > hij\). The total number of diners is \(2efg + hij\) which equals \(50N\) where \(N\) is the number of tables and \(2g+j=10\). This gave 2 possible solutions of which only \(752 + 346 = 1098\) satisfied (i). (1950 guests, 39 tables.) Putting 2g + j = 20 gave no solution. Similarly putting \(efgh\) and \(ij\) as the number of boys and \(2h + j\) equal to 10 or 20 quickly gave the other 3 solutions.