From The Sunday Times, 2nd May 1971 [link]
In Northminster the Premier is planning a reshuffle of five positions in his Cabinet. They are (in decreasing order of rank):
Deputy Premier,
Chancellor of the Purse-strings,
Minister of Mails,
Secretary of Science,
Head Whip.
At the moment these jobs are held (not respectively) by:
Attler,
Balfy,
Chamberton,
Disreel,
Edane.
Soon these five jobs are to be re-allocated among these five people and each person will get a different job from the one he holds at the moment.
In the reshuffle the Premier is going to promote Chamberton to Minister of the Mails, or above. Edane is also to be promoted. Attler has made it clear that if he is going to be junior to Chamberton, then the only Deputy Premier he would work under would be Disreel.
Balfy is going to be demoted, but one consolation is that after the reshuffle he will be senior to someone to whom at the moment he is junior. Finally, Disreel will become Deputy Premier only if Balfy becomes Minister of Mails.
The Premier tries to avoid a party split by arranging his reshuffle to satisfy all the above demands. Also he arranges it with the least number of demotions possible in the circumstances.
Who is the present Secretary of Science? And, who is to become Secretary of Science?
This puzzle was originally published with no title.
[teaser516]
Jim Randell 6:14 pm on 1 May 2020 Permalink |
This Python program runs in 172ms.
Run: [ @repl.it ]
from enigma import irange, inf, is_duplicate, factor, seq_all_different as all_different, filter_unique, iroot, printf # find numbers with different prime factors, and no repeated digits ns = list() for n in irange(1, 80): if is_duplicate(n): continue fs = factor(n) if fs and all_different(fs): ns.append(n) # find sets of k numbers, that use the digits 0-9 exactly once def generate(ns, k, ds=set(), s=[]): # are we done? if k == 0: if len(ds) == 10: yield tuple(s) else: # add in another number for (i, n) in enumerate(ns, start=1): t = str(n) if ds.intersection(t): continue yield from generate(ns[i:], k - 1, ds.union(t), s + [n]) # find 6-sets that are unique by sum (ss, _) = filter_unique(generate(ns, 6), sum) # find powers for n def powers(n, p=1): for k in irange(p, inf): x = iroot(n, k) if x ** k == n: yield (x, k) if x == 1: break # output solution for s in ss: t = sum(s) ps = list(powers(t, 2)) printf("{s} -> {t} {ps}")Solution: The numbers are: 2, 3, 41, 58, 69, 70.
The sum is 243 (= 3^5).
We can find 78 different sets of 6 numbers that use the digits 0-9 exactly once, but only the set given above has a unique sum (which is the largest possible sum).
LikeLike
GeoffR 11:25 am on 5 May 2020 Permalink |
The programme found four solutions, but only the first is a correct unique solution
ie Tickets: 2, 3, 41, 58, 69, 70.
There is anpother duplicate solution with a total of 216, but the programme did not find it. Two other potential solutions also had a total of 225, so do not give a unique solution.
The programme would only run under the Chuffed solver in a reasonable time.
LikeLike