*This post is part of a series on Mohammad Anwar’s excellent Perl Weekly Challenge, where Perl and Raku hackers submit solutions to two different challenges every week. (It’s a lot of fun, if you’re into that sort of thing.)*

Challenge #2 this week (43) is to **generate Self-descriptive Numbers in arbitrary bases.** A self-descriptive number, as described by Wikipedia, is an integer *m* that in a given base *b* is *b *digits long in which each digit *d* at position *n* (the most significant digit being at position 0 and the least significant at position *b* – 1) counts how many instances of digit *n* are in *m*.