Mastodon
sungate.co.uk

sungate.co.uk

Ramblings about stuff

A Mathematical Teaser

A while ago I wondered about putting up the occasional brainteaser or puzzle on this site, and this is the first one. Depending on how it goes down, it may also be the last. You Be The Judge.

First, let’s define a “self-representing number”. The easiest way is by example: 1210 is a four-digit self-representing number, because there are

  • 1 zeroes;
  • 2 ones;
  • 1 two;
  • 0 threes.

i.e. digits in the number represent the number of times each digit appears in the whole number, with the first digit representing the number of 0s, the second digit representing the number of 1s and so on.

The puzzle is as follows: can you find the only valid 10-digit self-representing number? As before, the first digit will represent the number of 0s in the whole 10-digit number, the second digit will represent the number of 1s in the whole 10-digit number and so on, with the final digit representing the number of 9s.

Is that clear now?

Go on, then: go work it out! If you’re trying to work it out, bear in mind that you may find ‘spoilers’ in the comments for this post… If you leave a comment with your answer, please indicate how you worked it out. Edit Sunday 23 April: there are now spoilers in the comments, so avoid reading them if you want to work it out for yourself. Might also be a good idea to avoid reading #lugradio too, since that’s where most of the current solutions have been discussed!

When I first found this puzzle a couple of years ago, I wrote a short bit of C code to brute-force a solution: basically to try all 10-digit numbers and see whether they met the criteria of a self-representing number: took a couple of hours, I think! I should say that this is almost certainly not the best way to solve this puzzle 😉

Good luck!

6 Responses to A Mathematical Teaser

  1. I got 6210001000, but I’m not sure if I interpreted the rules correctly.

    I started off with all zeroes, and worked my way along as it was clear that if there are zeroes, that means that there’s at least 1 , and so on until it stopped (which didn’t take long). My progress:
    0000000000 – ten zeroes, a no go
    9000000001 – 9 zeroes, means at least 1 nine, but that makes less than 9 zeroes
    8200000010 – 8 zeroes, 1 eight.. there needs to be a 1, but it can’t be 1 because that makes 2 ones, so less than eight zeroes then
    7210000100 – 7 zeroes, 1 seven, 2 ones.. there’s a two in there too.. that’s less than 7 zeroes which leads to
    6210001000

    Permalink
  2. Ah, I Googled, it seems the working wasn’t much different from mine: http://mathforum.org/kb/thread.jspa?threadID=1139464&messageID=3731402

    I feel all warm and fuzzy now 🙂

    Permalink
  3. 6210001000
    ||||||||||
    0123456789

    Took me 13 minutes, by hand, with a bit of pen and paper and counting on my fingers….

    There’s probably a cleverer to do it…. 🙂

    -Dx

    Permalink
  4. Took me 16 minutes, so D beat me. 🙁

    *claps* Encore! Encore!

    Permalink
  5. I’m glad this generated some interest, so I’ll do some more in the future. 🙂

    Permalink
  6. You saw me do it real time on #lugradio today 🙂

    Still haven’t posted the actual correct answer there, but I think you got the idea 😉

    8100000000 was still a funny first attempt 🙂

    Permalink

Comments are closed.