Teaser 2743: Line-up
From The Sunday Times, 19th April 2015 [link] [link]
I have arranged the numbers from 1 to 27 in a 3-by-3-by-3 cubical array. I have noticed that the nine numbers making up one of the faces of the cube are all primes.
Also, I have searched through the array and written down the sum of any three numbers that are in a straight line. I have then calculated the grand total of all those line-sums. It turns out that the grand total is itself a perfect cube!
What is that grand total?
[teaser2743]
Jim Randell 9:32 am on 30 August 2022 Permalink |
Considering a standard 3×3×3 Rubik’s cube, we can think of is as consisting of 27 cubelets:
And if we consider the number of lines each type of cubelet appears in we have:
The grand total then consists of:
And as long as we distribute the numbers amongst the same type of piece any arrangement will have the same grand total. (Although to confirm with the layout specified in the puzzle you have to keep the primes all together on one face).
There are only nine primes between 1 and 27 (= 2, 3, 5, 7, 11, 13, 17, 19, 23) and these are arranged on one of the faces, so we have 4 corners, 4 edges, and 1 centre that are prime.
So, we just need to split the primes into sets of size (4, 4, 1) with sums (p1, p2, p3), and the remaining 18 non-primes into sets of size (4, 8, 5, 1) with sums (n1, n2, n3, n4), such that:
This can be written as:
and we know that: (p1 + p2 + p3 + n1 + n2 + n3 + n4) = tri(27), so:
So the maximum possible value for T is 2363, giving a maximum possible cube of 13³ = 2197.
And the minimum possible value for T is 1731, giving a minimum possible cube of 13³ = 2197.
So, the only possibility for a grand total that is a cube is 13³ = 2197.
Solution: The grand total is 2197.
But now we need to show there is at least one solution.
If we do find a solution we can permute the numbers amongst their own groups without changing the grand total to give a class with (4! × 4! × 1!) × (4! × 8! × 5! × 1!) = 66886041600 solutions. (Which we can divide by 8 to account for reflections/rotations).
This Python program chooses a non-prime core value, and partitions the primes into sets of size (4, 1) and the remaining non-primes into sets of size (4, 5), and in each case the contribution to the grand total is recorded. We then look for pairs of contributions that can make a grand total that is a perfect cube. (There are many of these, so we stop when we have found a single example for a particular cube).
It runs in 13s and finds there are many possible core values that lead to viable solutions (and each of these has many partitions sums that lead to many solutions).
Run: [ @replit ]
from enigma import (irange, primes, subsets, intc, intf, cbrt, cb, printf) # partition set <s> into subsets with sizes in <ns> def partition(s, ns, ss=[]): if not ns: yield ss elif len(ns) == 1: for x in subsets(s, size=ns[0]): yield ss + [x] else: for x in subsets(s, size=ns[0]): yield from partition(s.difference(x), ns[1:], ss + [x]) # primes ps = set(primes.between(1, 27)) # non-primes nps = set(irange(1, 27)).difference(ps) # total of primes and non-primes (= tri(27)) t = sum(ps) + sum(nps) # record grand totals Ts = set() # split the primes into sets of size (4, 1) and record the contribution to the total pss = set(3 * sum(p1) + sum(p3) for (p1, p3) in partition(ps, (4, 1))) printf("[{n} prime partitions]", n=len(pss)) # choose the core value (non-prime) for v in nps: printf("[core={v}]") # split the remaining non-primes into sets of size (4, 5) and record the contribution to the total nss = set(3 * sum(n1) + sum(n3) for (n1, n3) in partition(nps.difference({v}), (4, 5))) printf("[{n} non-prime partitions]", n=len(nss)) # find possible cubes t0 = 4 * t + 9 * v cubes = set(cb(x) for x in irange(intc(cbrt(t0 + min(pss) + min(nss))), intf(cbrt(t0 + max(pss) + max(nss))))) printf("[possible cubes = {cubes}]", cubes=sorted(cubes)) # find pairs from pss and nss that give a cube grand total for T in cubes: for p in pss: n = T - t0 - p if n > 0 and n in nss: printf("[p={p} n={n} -> T={T}]") Ts.add(T) break # we only need one example for this T # output solution printf("grand total = {Ts}")There are many, many ways to place the numbers on the cube.
Here is one (this has 8 as the core value – the smallest possible, but it can be any non-prime value between 8 and 27):
In this solution the different types of cubelet are (prime + non-prime values):
And so the grand total is:
LikeLike