October 19, 2009

Digital Cubes

The number 153 is equal to the sum of the cubes of its digits:

13 + 53 + 33 = 1 + 125 + 27 = 153

There are three other 3-digit numbers with the same property, excluding numbers like 001 with a leading zero.

Can you find them?


- 13 comments by 2 or more people Not publicly viewable

[Skip to the latest comment]
  1. Matthew Jones

    ANSWER (to avoid a spoiler)

    19 Oct 2009, 10:54

  2. Iain Wallace

    370, 371, 407

    19 Oct 2009, 10:55

  3. Iain Wallace

    Dammit! :P

    19 Oct 2009, 10:56

  4. Eleanor Lovell

    Like what you’ve done there Matt… Nevermind Iain! : )

    19 Oct 2009, 11:32

  5. Matthew Jones

    Is there a clever way of doing this, rather than “Write a Ruby script”, which is what I did?

    19 Oct 2009, 12:01

  6. David Buckley

    I did this by hand in 40 minutes just to prove that it could be done.

    You only need to consider the digits rather than the numbers – the sume of the cubs of the digits of, say, 407 and 740 are the same, so you can just work with weakly descending digit sets.

    Then just work through everything. 9 is easy to eliminate as there are so few digit pairs summing to 19.). You never need to check ab0 as you’ve already computed a3+b3 and you can check the digits of that.

    I checked about 60 sums and eliminated the rest with reasoning like above.

    19 Oct 2009, 15:49

  7. David Buckley

    I meant of course a3 + b3 — I didn’t expect that markup to get me. Also “sum”, not “sume”, but I guess that was obvious. I’ll be sure to hit preview next time.

    19 Oct 2009, 15:55

  8. David Buckley

    Also, less obviously, something seems to have eaten the middle of one paragraph. Looks like it was mistaken for HTML! Sigh.

    There are few digit pairs summing to less than 270, which you can lower to 237 since 93 + higher numbers gives digits greater than 6, which are too large. I did my checks by summing the first two digits and testing the last one. You often don’t need to work out the whole sum as, for instance, 775 sums up to a number with last digit 3, which isn’t 5 or 7. Similarly you can often eliminate based on the first digit of the sum in the same way.

    19 Oct 2009, 16:02

  9. David Buckley

    Before I leave you alone, there are a number of Project Euler problems of a similar nature, for instance:

    http://projecteuler.net/index.php?section=problems&id=30

    http://projecteuler.net/index.php?section=problems&id=34

    19 Oct 2009, 16:04

  10. Simon Whitehoiuse

    I’ve been fiddling around with algorithms that might reduce the number of combinations that are checked. The best I’ve managed is to note that we don’t have to check all possible combinations of abc by looking at odds and evens.

    a b c sum
    o o o o
    o o e e
    o e o e
    o e e o
    e o o e
    e o e o
    e e o o
    e e e e

    Which means that all of the solutionss must be of the format OOO, OOE, EEO or EEE

    And then by dropping out of loops once

    {a^3} + {b^3} + {c^3} > 100a + 99

    Unfortunately, my Python is somewhat inelegant and I’ve not been able to break out of the loops as efficiently as I’d like, but this brings the number of checks to 239.

    Not as good as David’s 60 I’m afraid.

    19 Oct 2009, 22:15

  11. Eleanor Lovell

    Congrats to those who solved the problem – for those interested here is Ian Stewart’s explanation.

    The other 3-digit numbers that are equal to the sum of the cubes of their digits are 370, 371 and 407. If the digits are a, b, and c, then we have to solve 100a + 10b + c = a^3 + b^3 + c^3 with 0 ≤ a, b, c ≤ 9 and a > 0. That’s 900 possiblities, so a systematic search will find the answer.

    The work can be reduced by using some fairly simple tricks [as you noted]. For instance, if you divide a perfect cube by 9, the remainder is 0, 1 or 8. If you divide 100 or 10 by 9, the remainder is 1. So a + b + c and a^3 + b^3 + c^3 leave the same remainder on division by 9.

    Eliminating cases where the digits are too small or too big to work, a + b + c has to be one of 7, 8, 9, 10, 11, 16, 17, 18, 19, 20. After that… well you get the idea…

    Congrats to David and Simon for doing the working out! (and to those who used more ‘creative’ methods to find the answer!)

    20 Oct 2009, 16:53

  12. Iain Wallace

    Yeah, simple brute-force PHP script here!

    20 Oct 2009, 17:34

  13. fit-flops

    I am weak in maths from childhood so I am sorry I can’t answer you but ya I”ll ask this to my friends and pretend o be master in Maths. fit-flops

    21 Oct 2009, 07:39


Add a comment

You are not allowed to comment on this entry as it has restricted commenting permissions.

About Warwick Challenges

Warwick Challenges are mini academic challenges from University of Warwick professors, set via the micro-blogging service Twitter (and also via this blog).
More
Follow us on Twitter

October 2009

Mo Tu We Th Fr Sa Su
Sep |  Today  | Nov
         1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Search this blog

Blog archive

Loading…
Not signed in
Sign in

Powered by BlogBuilder
© MMXIX