Teaser 2783: Old boys’ banquet
From The Sunday Times, 24th January 2016 [link] [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?
[teaser2783]



Jim Randell 8:30 am on 13 September 2019 Permalink |
If s is the number of old boys without guests and g is the number with guests, then we have a pandigital sum of the form:
where s < g.
Altogether there are 10 digits used so, alphametically, the sum is one of:
This Python program uses the [[
SubstitutedSum()]] solver from the enigma.py library to examine solutions to both sums. It runs in 277ms.Run: [ @repl.it ]
from enigma import SubstitutedSum, div, printf # solve the pandigital sum digits = 'ABCDEFGHIJ' for k in (2, 3): (x, y, z) = (digits[0:k], digits[k:6], digits[6:]) p = SubstitutedSum([x, y], z) for s in p.solve(): # turn the solution into numbers (s, g, b) = (int(p.substitute(s, w)) for w in (x, y, z)) # more than half the old boys have guests if not (g > s): continue # so the total number of people is... t = b + g # and the number of tables is... n = div(t, 50) if n is None: continue printf("s={s} g={g} boys={b}, people={t} tables={n}")Solution: There are four possible solutions:
I suspect the setter intended the final solution to be the correct answer, which is the only solution where the pandigital sum is of the form: ABC + DEF = GHIJ.
A suitable upper limit on the total number of old boys, total number of people, or number of tables would eliminate the other solutions.
However if we change the condition in the puzzle text to:
(i.e. we require s > g).
Then there is only a single solution to the puzzle:
Reversing the inequality at line 12 of the program will give this solution.
LikeLike
GeoffR 1:59 pm on 14 September 2019 Permalink |
% A Solution in MiniZinc include "globals.mzn"; var 0..9: a; var 0..9: b; var 0..9: c; var 0..9: d; var 0..9: e; var 0..9: f; var 0..9: g; var 0..9: h; var 0..9: i; var 0..9: j; % Assume boys/boys with guest/total boys are in ratio 3:3:4 var 100..999: abc; % boys with guest var 100..999: def; % boys alone var 1000..2000: ghij; % total boys var 0..250: tables; % total tables % All ten digits are used exactly once constraint alldifferent([a,b,c,d,e,f,g,h,i,j]) /\ a > 0 /\ d > 0 /\ g > 0; constraint abc = 100*a + 10*b + c /\ def = 100*d + 10*e + f /\ ghij = 1000*g + 100*h + 10*i + j ; % More than half the boys brought a female guest constraint abc > ghij div 2; constraint abc + def == ghij; constraint tables * 50 == abc * 2 + def; solve satisfy; output [" Boys with a guest: " ++ show(abc) ++ "\n" ++ " Boys on their own: " ++ show(def) ++ "\n" ++ " Total boys: " ++ show(ghij) ++ "\n" ++ " Tables: " ++ show(tables)]; % Boys with a guest: 752 % Boys on their own: 346 % Total boys: 1098 % Tables: 37 % ---------- % ==========LikeLike