Numbers Made of Their Own Digits

  • Medium
  • Number puzzles
  • Tests: Searching a small space with a rule

The puzzle

153 = 1³ + 5³ + 3³. A number equal to the sum of the cubes of its own digits.

Find the others with three digits. How would you search without checking all 900?

Stuck?

One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.

Hint 1

The largest possible digit cube is 9³ = 729, so three digits can never exceed 2187 - the search is already bounded.

Hint 2

A number with a 9 in it is pulled sharply upwards; one made of small digits cannot reach its own size.

Show the answer Hide the answer

Four in all: 153, 370, 371 and 407.

How to get there

153 = 1 + 125 + 27. 370 = 27 + 343 + 0. 371 = 27 + 343 + 1. 407 = 64 + 0 + 343. There are no others with three digits.

The search is small. Three digits cannot sum past 3 × 729 = 2187, and in practice the digits have to be fairly large to reach a three-digit total at all - 1³+1³+1³ is only 3. Working through the plausible digit sets takes minutes by hand.

The idea generalises: a number equal to the sum of its digits each raised to the number of digits is called narcissistic. There are exactly 88 of them in base ten, the largest having 39 digits - and then they stop entirely, because 9^n grows more slowly than 10^n and eventually no number can reach itself.

The technique worth keeping

Bound the search before starting it. Finding the largest value the rule could possibly produce turns an open-ended hunt into a finite check, and often shows the answers must be few.