Hollow Cubes investigation

Hollow cubes like the picture above [reference] are an extension of the hollow squares investigation done previously.  This time we can imagine a 3 dimensional stack of soldiers, and so try to work out which numbers of soldiers can be arranged into hollow cubes.

Therefore what we need to find is what numbers can be formed from a3-b3

Python code

We can write some Python3 code to find this out (this can be run here):

``` for k in range(1,200):```

```  for a in range(0, 100):   for b in range(0,100):    if a**3-b**3 == k :     print(k,a,b) ```

This gives the following: (the first number is the number of soldiers and the 2 subsequent numbers are the 2 cubes).

1 1 0
7 2 1
8 2 0
19 3 2
26 3 1
27 3 0
37 4 3
56 4 2
61 5 4
63 4 1
64 4 0
91 6 5
98 5 3
117 5 2
124 5 1
125 5 0
127 7 6
152 6 4
169 8 7
189 6 3

We could perhaps investigate any patterns in these numbers, or explore how we can predict when a hollow cube has more than one solution. I’ll investigate which numbers can be written as both a hollow square and also a hollow cube.

Hollow squares and hollow cubes

``` list1=[] for a in range(2, 50):  for b in range(2,50):   if a**2-b**2 !=0:    if a**2-b**2 > 0:     list1.append(a**2-b**2) list2=[] for j in list1:  for c in range(2,50):   for d in range(2,50):    if c**3-d**3 == j:     list2.append(c**3-d**3) print(list2) ```

This returns the following numbers which can all be written as both hollow squares and hollow cubes.

[56, 91, 19, 117, 189, 56, 208, 189, 217, 37, 279, 152, 117, 448, 513, 504, 448, 504, 387, 665, 504, 208, 875, 819, 936, 817, 61, 999, 988, 448, 728, 513, 189, 1216, 936, 784, 335, 469, 1323, 819, 1512, 1352, 1197, 992, 296, 152, 1519, 1512, 1197, 657, 1664, 1323, 1647, 1736, 1701, 1664, 936, 504, 2107, 1387, 1216, 1027, 91, 2015, 279, 2232]

Hollow squares, cubes and hypercubes

Taking this further, can we find any number which can be written as a hollow square, hollow cube and hollow hypercube (4 dimensional cube)? This would require our soldiers to be able to be stretch out into a 4th dimensional space – but let’s see if it’s theoretically possible.

Here’s the extra code to type:

``` list1=[] for a in range(2, 200):  for b in range(2,200):   if a**2-b**2 !=0:    if a**2-b**2 > 0:     list1.append(a**2-b**2) list2=[] for j in list1:  for c in range(2,200):   for d in range(2,200):    if c**3-d**3 == j:     list2.append(c**3-d**3) print(list2) for k in list2:  for e in range(2,200):   for f in range(2,200):    if k == e**4-f**4:     print(k) ```

Very pleasingly this does indeed find some solutions:

9919: Which can be formed as either 1002-92 or 223-93 or 104-34.

14625: Which can be formed as either 1212-42 or 253-103 or 114-24.

Given that these took some time to find, I think it’ll require a lot of computer power (or a better designed code) to find any number which is a hollow square, hollow cube, hollow hypercube and hollow 5-dimensional cube, but I would expect that there is a number out there that satisfies all criteria. Maybe you can find it?