# Enigmatic Code

Programming Enigma Puzzles

## Enigma 1004: The art of cubes

From New Scientist #2159, 7th November 1998 [link]

The great artist Pussicato started his latest work by selecting the number 28 as his starter. He wrote down the divisors of 28, namely, 1, 2, 4, 7, 14, and 28. He then wrote down how many divisors each of these numbers has: 1 has 1, 2 has 2, 4 has 3, 7 has 2, 14 has 4, and 28 has 6. He took these numbers of divisors. 1, 2, 3, 2, 4 and 6, to his studio and carved out 6 cubes with dimensions: 1 × 1 × 1, 2 × 2 × 2, 3 × 3 × 3, 2 × 2 × 2, 4 × 4 × 4 and 6 × 6 × 6.

Pussicato arranged the cubes tastefully and called the work “28”. He also noticed the total volume of the work was 324.

Question 1: Is it possible for Pussicato to choose a starter so that the resulting collection of cubes has a total volume of 729? If it is, what is the smallest starter he can use?

Question 2: Is is possible for Pussicato to choose a starter so that the resulting collection of cubes has a total volume of 47,382. If it is, what is the smallest starter he can use?

Question 3: Pussicato chose a starter and produced a collection of cubes with a total volume of 571,536. He then piled the cubes, one on top of the other, to form a high tower. How high was the tower?

[enigma1004]

### One response to “Enigma 1004: The art of cubes”

1. Jim Randell 28 June 2019 at 7:49 am

If we denote the number of divisors of n by the function tau(n), then the function we are interested in is:

F(n) = sum(tau(d)³ where d divides n)

Interestingly the following is also a definition of F(n):

f(n) = sum(tau(d) where d divides n)
F(n) = f(n)²

(This is an early result from this paper [ link ] which examines sequences where the sum of the cubes of the elements of the sequence is equal to the square of the sum of the sequence).

So, in our puzzle, we can immediately eliminate any candidate volumes that are not perfect squares:

729 = 27²
47382 is not a square
571536 = 756²

And look for appropriate numbers such that f(n) gives the square root of the remaining values.

If the cubes are made into a tower than the height of the tower is f(n) units.

This Python program runs in 571ms.

Run: [ @repl.it ]

```from enigma import is_square, divisors, tau, irange, inf, arg, args, printf

k = arg(1, 0, int) # number of examples to find
vs = args([324, 729, 47382, 571536], 1, int) # values to look for
printf("[k=1; vs={vs}]")

# check values that are perfect squares
ns = dict()
for v in vs:
n = is_square(v)
if n is not None:
ns[n] = list()
else:

# find the sum of the number of divisors of each divisor of n
f = lambda n: sum(tau(d) for d in divisors(n))

# look for k values that give f(n) = r
for n in irange(1, inf):
r = f(n)
s = ns.get(r, None)
if s is None: continue
if len(s) < k: s.append(n)
if not any(len(s) < k for s in ns.values()): break

# output the candidate numbers
for n in sorted(ns.keys()):
printf("{v} ({n}^2) -> {s}", v=n * n, s=ns[n])
```

Solution: (1) Pussicato can get a total volume of 729. The smallest starting number is 30; (2) It is not possible to get a total volume of 47,382; (3) The tower was 756 units high.

The numbers form themselves into classes when characterised by F(n), according to their decomposition into prime factors.

1 is the only number with 1 divisor, so:

F(1) = 1³ = 1

Any prime p has divisors of 1 and p, so:

F(p) = 1³ + 2³ = 9

The square of a prime has divisors of 1, p and , so:

F(p²) = 1³ + 2³ + 3³ = 36

The product of two primes p.q has divisors of 1, p, q and p.q, so:

F(p.q) = 1³ + 2³ + 2³ + 4³ = 81

The product p².q has divisors of 1, p, q, , p.q and p².q, so:

F(p².q) = 1³ + 2³ + 2³ + 3³ + 4³ + 6³ = 324

And this is the example given:

F(28) = F(2².7) = 324

And we can immediately find other numbers that give the same result:

12, 18, 20, 28, 44, 45, 50, 52, 63, 68, 75, 76, 92, 98, 99, …

(see: OEIS A054753 [ link ]).

For three distinct primes p.q.r we have divisors of 1, p, q, r, p.q, p.r, q.r and p.q.r, so:

F(p.q.r) = 1³ + 2³ + 2³ + 2³ + 4³ + 4³ + 4³ + 8³ = 729

And this is the value we are asked to find in (1), so we can immediately give the sequence of values that give this result:

30, 42, 66, 70, 78, 102, 105, 110, 114, 130, 138, 154, 165, …

(see: OEIS A007304 [ link ])

For (3), we don’t need to find a possible starting value, as we know the height of the cubes is the square root of the number given.

But the sequence is:

6720, 7200, 10560, 12480, 14112, 14784, 16320, 17472, 18240, …

The sequence of values for F(n) is given in OEIS A097988 [ link ].

This site uses Akismet to reduce spam. Learn how your comment data is processed.