user
This task has been clarified. Its programming examples are in need of review to ensure that they still fit the requirements of the task.

There are several so-called "self-describing" or "self-descriptive" integers.

An integer is said to be "self-describing" if it has 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 are two 0s in the number;
* position   1   has value   0   and there are no 1s in the number;
* position   2   has value   2   and there are two 2s;
* position   3   has value   0   and there are zero 3s.

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

Task Description

1. Write a function/routine/method/... that will check whether a given positive integer is self-describing.
2. As an optional stretch goal - generate and display the set of self-describing numbers.

Related tasks

* Fours is the number of letters in the ...
* Look-and-say sequence
* Number names
* Self-referential sequence
* Spelling of ordinal numbers
assistant
(formerly Perl 6)

```
my @values = <1210 2020 21200 3211000
42101000 521001000 6210001000 27 115508>;

for @values -> $test {
    say "$test is {sdn($test) ?? '' !! 'NOT ' }a self describing number.";
}

sub sdn($n) {
    my $s = $n.Str;
    my $chars = $s.chars;
    my @a = +«$s.comb;
    my @b;
    for @a -> $i {
        return False if $i >= $chars;
        ++@b[$i];
    }
    @b[$_] //= 0 for ^$chars;
    @a eqv @b;
}

.say if .&sdn for ^9999999;

```

Output:

```
1210 is a self describing number.
2020 is a self describing number.
21200 is a self describing number.
3211000 is a self describing number.
42101000 is a self describing number.
521001000 is a self describing number.
6210001000 is a self describing number.
27 is NOT a self describing number.
115508 is NOT a self describing number.
1210
2020
21200
3211000

```