**When do 2 squares equal 2 cubes?**

Following on from the hollow square investigation this time I will investigate what numbers can be written as both the sum of 2 squares, 2 cubes and 2 powers of 4. i.e a^{2}+b^{2} = c^{3}+d^{3} = e^{4}+f^{4}.

Geometrically we can think of this as trying to find an array of balls such that we can arrange them into 2 squares, or we can rearrange them and stack them to form 2 cubes, or indeed we can arrange them into 2 4-dimensional cubes. I’ll add the constraints that all of a,b,c,d,e,f should be greater than 1 and that the pair of squares or cubes (etc) must be distinct. Therefore we can’t for example have 2 squares the same size.

**Infinite solutions**

Let’s look at why we can easily find infinite solutions if the squares or cubes (etc) can be the same size.

We want to find solutions to:

a^{2}+b^{2} = c^{3}+d^{3} = e^{4}+f^{4}.

so we look at the powers 2,3,4 which have LCM of 12. Therefore if we choose powers with the same base we can find a solution. For example we chose to work with base 2. Therefore we choose

a = 2^{6}, b = 2^{6}, which gives 2^{12}+2^{12}

c = 2^{4}, d = 2^{4}, which gives 2^{12}+2^{12}

e = 2^{3}, f = 2^{3}, which gives 2^{12}+2^{12}

Clearly these will be the same. So we can choose any base we wish, and make the powers into the same multiples of 12 to find infinite solutions.

**Writing some code**

Here is some code that will find some other solutions:

list1=[]

for a in range(2, 200):

for b in range(2,200):

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,e,f)

This returns the following solutions: 8192, 18737, 76832. Of these we reject the first as this is the solution 2^{12}+2^{12} which we found earlier and which uses repeated values for the squares, cubes and powers of 4. The 3rd solution we also reject as this is formed by 14 ^{4} + 14 ^{4}. Therefore the only solution up to 79202 (we checked every value up to and including 199^{2} + 199^{2}) is:

18737 = 64^{2}+121^{2} = 17^{3}+24^{3} = 11^{4}+8^{4}.

Therefore if we had 18,737 balls we could arrange them into 2 squares, a 64×64 square and a 121×121 square. Alternatively we could rearrange them into 2 cubes, one 17x17x17 and one 24x24x24. Or we could enter a higher dimensional space and create 2 tesseracts one with sides 11x11x11x11 and the other with 14x14x14x14.

With only 1 solution for around the first 80,000 numbers it looks like these numbers are quite rare – could you find another one? And could you find one that also satisfies g^{5}+h^{5}?

## Leave a comment

Comments feed for this article