A cute result relating to sums of cubes

It’s well known, and easy to prove, that

1^3+2^3+3^3+cdots +n^3=(1+2+3+cdots +n)^2.

But here’s a generalization of that which has been attributed to Joseph Liouville (1809 – 1882). Pick any number, say 56, and write down all of its divisors:

[1, 2, 4, 7, 8, 14, 28, 56]

Now, for each number in that list, write down the number of its divisors:

[1, 2, 3, 2, 4, 4, 6, 8]

For example, 7 has 2 divisors (1 and 7), and 14 has 4 divisors (1, 2, 7 and 14). But for this second list, the sum of its cubes equals the square of its sum!



Here’s a quick check with Sage:

sage: n = 56
sage: L=[number_of_divisors(i) for i in divisors(n)];L
  [1, 2, 3, 2, 4, 4, 6, 8]
sage: sum(L)^2,sum(i^3 for i in L)
  (900, 900)

And now to prove this result. Start by saying that a list has the square-cube (SC) property if the sum of its cubes equals to the square of its sum. So any list [1,2,3,ldots,n] has the SC property, as does the list [1, 2, 3, 2, 4, 4, 6, 8]. Also define the pairwise product of two lists A and B to be the list Aotimes B consisting of all possible products of pairs of elements from A and B. In other words:

Aotimes B={ab : {a,b}in Atimes B}

where of course Atimes B is the Cartesian product. From the definition then it is easy to show that,

displaystyle{sum_{xin Aotimes B}x=bigg(sum_{ain A}abigg)bigg(sum_{bin B}bbigg)}.

For example, if A=[1,2,3] and B=[1,2,3,4] then

Aotimes B=[1,2,3,2,4,6,3,6,9,4,8,12]

with sum 60, which is equal to the product of the sums of A and B. Note that

displaystyle{sum_{xin Aotimes B}x = sum_{ain A,bin B}ab}

displaystyle{=sum_{ain A}bigg(sum_{bin B}abbigg)}

displaystyle{=bigg(sum_{ain A}abigg)bigg(sum_{bin B}bbigg)}.

It follows immediately from this that if A and B are two lists each of which has the SC property, then so does Aotimes B. To see this, suppose that

displaystyle{sum_{ain A}a^3=bigg(sum_{ain A}abigg)^2}


displaystyle{sum_{bin B}b^3=bigg(sum_{bin B}bbigg)^2}.

Multiplying these together produces

displaystyle{bigg(sum_{ain A}a^3bigg)bigg(sum_{bin B}b^3bigg)=bigg(sum_{ain A}abigg)^2bigg(sum_{bin B}bbigg)^2}.

The right hand side is equal to

displaystyle{bigg[bigg(sum_{ain A}abigg)bigg(sum_{bin B}bbigg)bigg]^2}

displaystyle{=bigg[sum_{ain A,bin B}abbigg]^2}

displaystyle{=bigg(sum_{xin Aotimes B}xbigg)^2}.

By the same reasoning as above, the left hand side is equal to

displaystyle{sum_{ain A,bin B}(ab)^3=sum_{xin Aotimes B}x^3.}

By induction, if A_i is a collection of lists all with the SC property, then A_1otimes A_2otimescdotsotimes A_k has the SC property.

Consider n and its decomposition into prime factors:

n = p_1^{e_1}p_2^{e_2}cdots p_k^{e_k}.

For any prime power m= p^e the number of divisors of m is e+1; the divisors are all the powers of p from 1 to p^e. And the numbers of divisors of all those prime powers are [1,2,3,ldots,e+1]. Consider now m = p^eq^d. The divisors are p^rq^s for all values of r between 1 and e, and all values of s between 1 and d. The number of divisors of p^rq^s are (r+1)(s+1). From this it follows that the number of divisors of the divisors of m is

[1,2,3,ldots,e+1]otimes [1,2,3ldots d+1].

and hence which has the SC property. The general result follows by induction on the number of distinct prime factors of n.

Published proofs and further discussion can be found in “An Interesting Number Fact” by David Pagni, The Mathematical Gazette, Vol. 82, No. 494, Jul., 1998, and “Generalising ‘Sums of Cubes Equal to Squares of Sums'” by John Mason, The Mathematical Gazette, Vol. 85, No. 502, Mar., 2001.

13 thoughts on “A cute result relating to sums of cubes

  1. Great result, but is it really a “generalization”? It’s clearly related but I don’t see the original result as a special case.

    1. Sure it’s a generalization, though not 100% obvious.

      Remember, the list has to come from the number of divisors of the divisors of a number. So pick p^n; the divisors are exactly [1,p,p^2,ldots,p^n], so the number of divisors of each of those is [1,2,3,ldots,n+1].

      What a cool result! I’ll be sure to use it the next time I teach number theory.

  2. Pity it is all completely plagarised – but that is the way with most of this so called “academics” work.

    1. Is it really? Where from? I know the result is old, but I hadn’t seen this proof before! Please send me the links. (I haven’t actually read the articles I referenced at the end.)

      1. Snape, that’s flame-bait! I wouldn’t say plagiarized, just well-known, as amca01 himself points out.

        I hadn’t seen this proof before either. As it turns out, because he didn’t use the standard tau notation for the ‘number of divisors’ function, I forgot that this is a standard ‘hard’ exercise in many number theory texts. But a nice way to present it, and nice way to introduce it for folks who are not familiar with arithmetic functions.

    2. This must be some unfamiliar usage of the word “plagiarized” – the author presents a well known theorem, then a cute result that is attributed to Liouville. This is popularization, not plagiarism, bringing to light an interesting but perhaps unknown-to-the audience result. I found it interesting and learned something, thus it served its purpose for me. Plagiarism would have been if the author had claimed the result as his own, which he very clearly did not.

  3. I’m extremely pleased to uncover this web site. I need to to thank you for ones time for this particularly wonderful read!! I definitely liked every little bit of it and I have you book marked to look at new stuff on your blog.

  4. Coming late to this party, but just wanted to add that the original “sum of the first n cubes equals the square of the sum of the first n integers” is clearly a special case of Liouville’s rule. Consider any nth power of some prime p, eg 3^4 = 81. It has five divisors, ie 81, 27, 9, 3 and 1. 27 has four divisors. 9 has three. 3 has two. And 1 has one. The rest should be obvious.

Leave a Reply

Your email address will not be published. Required fields are marked *