# Numbers that are the sum of the cubes of their digits

There are just four 3-digit numbers which are the sums of the cubes of their digits. For example:

$$370 = 3^3 + 7^3 + 0^3$$ and $$371 = 3^3 + 7^3 + 1^3$$.

Without using a calculator/computer, can you find the other two 3-digit numbers with this property? Are there any more such numbers?

• Spoilers: answer inside. I’m pretty sure the first part of the answer has to be done by exhaustion. The second part is an actually interesting problem, though – El-Guest Jun 5 at 3:46
• See also OEIS: A005188 – Daniel Mathias Jun 5 at 9:55
• By a difficult and exhaustive search, I've found two more numbers that are the sum of the cubes of their digits: $0, 1$. – Paul Sinclair Jun 5 at 17:32

We are finding digits $$a,b,c$$ such that $$100a+10b+c=a^3+b^3+c^3$$. Taking $$\pmod 9$$, we have $$\big(a^3-a\big)+\big(b^3-b\big)+\big(c^3-c\big)\equiv0\pmod9$$
These are the values of remainder of $$a^3-a$$ divided by $$9$$:

a(mod 9)|a^3-a(mod 9)
0       |0
1       |0
2       |6
3       |6
4       |6
5       |3
6       |3
7       |3
8       |0


So

The $$3$$ digit numbers that satisfy the condition are either all digits from either groups $$(0,1,8,9), (2,3,4), (5,6,7)$$ or one digit per group.

• Now it reduces to 42 possibilities, which can be easily bruteforced by hand. – trolley813 Jun 5 at 14:10

I happen to know them. Does that count as a valid answer? When I was young, we 'discovered' that repeatedly applying the procedure $$abc \to a^3 + b^3 + c^3$$ always ended up at one of four numbers; 370, 371,

$$153 = 1^3 + 5^3 + 3^3$$ or $$407 = 4^3 + 0^3 + 7^3$$.

For me, it's hard to forget, just like this anecdote about Hardy visiting Ramanujan:

I remember once going to see him when he was ill at Putney. I had ridden in taxi cab number 1729 and remarked that the number seemed to me rather a dull one, and that I hoped it was not an unfavourable omen. "No," he replied, "it is a very interesting number; it is the smallest number expressible as the sum of two cubes in two different ways."

($$1729 = 1^3 + 12^3 = 9^3 + 10^3$$)

• Haha well that works too, if you already know the answer :) – Dmitry Kamenetsky Jun 5 at 6:53
• That is one of my favorite maths stories, along with Gauss summing 1+2+...+100 in a few seconds in class. I am not entirely sure that the events actually took place, but they certainly make great stories. – Dmitry Kamenetsky Jun 5 at 7:03
• Somebody needs to find that taxi cab (or at least the number sign from the top of it) and install it in a mathematics-themed museum somewhere. – Darrel Hoffman Jun 5 at 13:45

To show there is no four digit solution, the maximum sum of the cubes of the digits of a four digit number is $$4\cdot 9^3=2912$$ For a number less than this, the maximum sum of the cubes of the digits is $$1+3\cdot 9^3=2188$$. The thousands digit must be $$1$$. To get the sum of cubes up to $$1000$$ we need a $$9$$, two $$8$$s, one $$8$$ plus two $$7$$s, or three $$7$$s. We can check that $$1,7,7,7$$ and $$1,7,7,8$$ fail. With two $$8$$s we have $$1^3+2\cdot 8^3=1025$$ and all the possibilities fail. Then $$1^3+9^3=730$$ We need another digit to be at least $$4$$ to get up to $$1000$$. This is in the range of hand check as well and nothing works.

• The thousands digit must be 1. Why? – Ross Presser Jun 5 at 13:30
• Because the sum of the cubes is less than 2188 at that point and no number with a thousands digit of $2$ matches its sum of cubes because the lower digits cannot contribute enough. – Ross Millikan Jun 5 at 13:37

There are

• two 1-digit solutions: $$0,1$$
• no 2-digit solutions: $$5$$ and above have 3-digit cubes. A digit of $$4$$ would require the number to have another digit of $$6$$ or above. The 12 possibilities with digits $$\le 3$$ are easily eliminated.
• four 3-digit solutions, as indicated in the question.
• no 4-digit solutions, as Ross Millikan has proved.
• no higher-digit solutions, as for $$n > 4, n \times 9^3$$ has fewer than $$n$$ digits.

So there are six numbers total that are the sum of the cubes of their digits.