Self describing numbers!

Logic Level 3

The number 521001000 is a number that describes itself because the digits represent the number of occurrences of each digit specified. That is, 5 represents the number of zeroes, 2 represents the number of ones, and so on.

Another example of this number would be 3211000 which has 3 zeroes, 2 ones, 1 two, and so on.

What is the smallest number that exhibits this property?


The answer is 1210.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

The desired number must contain at least one 0 , 0, since we can't have the number starting with a 0. 0. If we then have one 0 , 0, the second digit cannot be 0 , 0, since we have one 1 1 already, and it can't be 1 1 either, since we would then already have two 1 1 's.

If the first two digits are then 12 , 12, the third digit cannot be 0 , 0, since we already have a 2. 2. So in order to have one 0 0 we must place it as the fourth digit, leaving us with 1210 \boxed{1210} as the smallest self-describing positive integer.

Why not 1012?

Roman Frago - 5 years, 11 months ago

Log in to reply

1012 1012 has two 1 1 's, so would require a 2 2 as the second digit to be self-describing. It also has a 2 2 as the fourth digit, so would have to have two 3 3 's to be self-describing.

Brian Charlesworth - 5 years, 11 months ago

Log in to reply

Only now I understood the definition...lol.

Roman Frago - 5 years, 11 months ago

why not 10?

Archie Magsucang - 5 years, 10 months ago

Log in to reply

For 10 to be self-describing it would need to have 1 zero and zero 1's, so since it has one 1 it is not self-describing.

Brian Charlesworth - 5 years, 10 months ago

Log in to reply

ahh, thank you.

Archie Magsucang - 5 years, 9 months ago

why not 1120

uttkarsh kohli - 5 years, 10 months ago

Log in to reply

For 1120 to be self-describing it would have to have one 1 and two 2's, which is not the case.

Brian Charlesworth - 5 years, 10 months ago

Log in to reply

thx for clearing my doubt

uttkarsh kohli - 5 years, 10 months ago
Rama Devi
Jul 10, 2015

https://en.wikipedia.org/wiki/Self-descriptive_number

see the link

I've simply written a small program to solve this problem for me: link . It gave 1210 as the answer. I feel that designing the algorithm is harder than just using logic to solve this puzzle, so this solution is for those who are CS oriented.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...