Self-describing numbers

From Rosetta Code
Revision as of 04:24, 8 May 2011 by rosettacode>Xkrouhn (Created page with "Self-describing numbers: There are several integers numbers called "self-describing". Integers with the property that, when digit positions are labeled 0 to N-1, the digit ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Self-describing numbers:

There are several integers numbers called "self-describing".

Integers with the property that, when digit positions are labeled 0 to N-1, the digit in each position is equal to the number of times that that digit appears in the number.

For example 2020 is a four digit self describing number.

Position "0" has value 2 and there is two 0 in the number. Position "1" has value 0 because there are not 1's in the number. Position "2" has value 2 and there is two 2. And the position "3" has value 0 and there are zero 3's.

Self-describing numbers < 100.000.000 : 1210 - 2020 - 21200 - 3211000 - 42101000