The Weekly Challenge - 174

Monday, Jul 18, 2022| Tags: Perl, Raku










09. TASK #1: Disarium Numbers

10. TASK #2: Permutation Ranking


Welcome to Week #174 of the weekly challenge.

I nominate, Roger Bell_West for the signed copy of Learning Perl, 8th edition by brian d foy. This is the last copy we had, so a big Thank You to brian d foy for the generous offer.

Laurent Rosenfeld is on mission of some kind as he shared the maximum guest solutions i.e. 27. He also introduced a new guest language, Dc. Not only he shared solutions in Dc but also wrote a dedicated blog post sharing the background of the new language. He is currently ranked #6 in the Guest Leaders Board and ranked #1 in the Team Leaders Board.

I would like mention two members of Team PWC i.e. Athanasius and E. Choroba for the contributions week after week consistently. It is not just solutions but quality solutions. Don’t believe me? Take a look at Reviews by Colin Crain.

As I understand, holiday season is going on, some of the regular team members also taking a well deserved break. I noticed this when Luca Ferrari suddenly disappeared from the scene. Luckily he is back again wit his Raku and PostgreSQL. He is a regular blogger too, so we had blog post as well.

Roger Bell_West is on holiday too but being a member of Early Bird Club he had access to the future tasks in advance. Therfore we had his contributions in Perl and Raku. He is a regular guest contributors as well, so we had varieties of solutions in JavaScript, Kotlin, Lua, Postscript, Python, Ruby and Rust. We had the bonus on top of that, a blog post. No wonder, he is ranked #2 in the Team Leaders and Guest Leaders.

In Week #172, I shared solutions to both tasks in Perl and Raku. It was great a feeling. Now in the Week #173, I repeated the same, solved both tasks in Perl and Raku. Also like last time, I shared solutions in Python. This time, I even had time to do both tasks in Java and just one in Swift.

Atlast, I have the final list of champions for the 1000 days celebration. The latest champion PokGoPun has shared the details. So now we have altogether 39 champions. It is time to place the order of specially designed T-shirt. The credit goes to Lance Wicks for the design.

Good luck for the next challenge.

Blogs with Creative Title

1. Suffering Succotash! by Adam Russell.

2. Esthetic Sylvester by Arne Sommer.

3. Aesthetics and a fast-growing sequence by Peter Campbell Smith.

4. The Aesthetics of Sylvester by Roger Bell_West.

GitHub Repository Stats

1. Commits: 26,664 (+157)

2. Pull Requests: 6,450 (+38)

3. Contributors: 199

4. Fork: 253 (+1)

5. Stars: 142 (+1)

Our solo sponsor Pete Sergeant has been a great support to keep us motivated. We are lucky that he agreed to continue the journey with us in the year 2022. I would like to personally thank Pete and his entire team for their generosity. It would be great if we could add few more to sponsor the prize money so that we could go back and declare weekly champions as we have done in the past. I hope and wish this will become possible in 2022. The amount doesn’t have to be huge. However, it would be nice to show off bunch of supporters. If an organisation comes forward and supports us then that would be the ultimate achievement.


Quick recap of The Weekly Challenge - 173 by Mohammad S Anwar.


Please check out Perl solutions review of The Weekly Challenge - 168 by Colin Crain.

If you missed any past reviews then please check out the collection.


If you missed any past reviews then please check out the collection.


Please take a look at the charts showing interesting data.

I would like to THANK every member of the team for their valuable suggestions. Please do share your experience with us.


Please find out How to contribute?, if you have any doubts.

Please try the excellent tool EZPWC created by respected member Saif Ahmed of Team PWC.


Please checkout the guest contributions for the Week #173.

Please find past solutions by respected guests. Please share your creative solutions in other languages.

Task 1: Disarium Numbers

Submitted by: Mohammad S Anwar

Write a script to generate first 19 Disarium Numbers.

A disarium number is an integer where the sum of each digit raised to the power of its position in the number, is equal to the number.

For example,

518 is a disarium number as (5 ** 1) + (1 ** 2) + (8 ** 3) => 5 + 1 + 512 => 518

Task 2: Permutation Ranking

Submitted by: Mohammad S Anwar

You are given a list of integers with no duplicates, e.g. [0, 1, 2].

Write two functions, permutation2rank() which will take the list and determine its rank (starting at 0) in the set of possible permutations arranged in lexicographic order, and rank2permutation() which will take the list and a rank number and produce just that permutation.

Please checkout this post for more informations and algorithm.

Given the list [0, 1, 2] the ordered permutations are:

0: [0, 1, 2]
1: [0, 2, 1]
2: [1, 0, 2]
3: [1, 2, 0]
4: [2, 0, 1]
5: [2, 1, 0]

and therefore:

permutation2rank([1, 0, 2]) = 2

rank2permutation([0, 1, 2], 1) = [0, 2, 1]

Last date to submit the solution 23:59 (UK Time) Sunday 24th July 2022.


If you have any suggestions or ideas then please do share with us.

Contact with me