The Weekly Challenge - 147

Monday, Jan 10, 2022| Tags: Perl, Raku










09. TASK #1: Truncatable Prime

10. TASK #2: Pentagon Numbers


Welcome to the Week #147 with the interview with the champion, Peter Campbell Smith.

Do you know about Early Bird Club?

Well, it is a private club whose members get the first glimpse of the upcoming challenges before the general public. Anyone can join the club by just writing one line email to The club members also help me review the tasks. I would like to take the opportunity to say a very big THANK YOU to the members of the club. Believe it or not, we do our best to describe the task in such a way that you get the idea in the first instance. I accept failure on my behalf that you still find ambiguity some weeks. Please accept my apology if you find it difficult to follow the task. I will continue to work on it.

Well done, Team PWC, for crossing the 100+ mark once again. Last time we breached the target was in the Week #141.

As far as the guest contributions are concerned, for the second consecutive weeks, we reached the maximum so far i.e. 90. I am sure, very soon we would go past 100 mark. Like the week before, this week also the three main contributors are Abigail, Roger Bell_West and Laurent Rosenfeld. I am also contributing every week in Python, Java and Swift on top of Perl and Raku.

Did you notice, I still call the team, Team PWC, even though we are now called The Weekly Challenge? Well I am emotionally attached to the name. Therefore I decided to keep calling Team PWC and nothing else. It feels great when other also refer with the same name.

Any update with regard to the FREE T-shirt campaign?

There has been no response from the remaining champions. I am still waiting for confirmations from 21 champions. This is a lot and I don’t to miss them. I would give another couple of weeks time. If I still don’t receive confirmation then I will go ahead without them. Sorry.

Blogs with Creative Title

1. Fractionally Prime with Raku and Perl by Arne Sommer.

2. Fractions, Trees and Primes: Weekly Challenge 146 by Dave Jacoby

3. Large primes and curious fractions by Peter Campbell Smith.

4. The Weekly Challenge 146: Curious Prime by Roger Bell_West.

5: 2 Fractions and a Prime by Simon Green,

GitHub Repository Stats

1. Commits: 22,557 (+197)

2. Pull Requests: 5,489 (+39)

3. Contributors: 185

4. Fork: 236

5. Stars: 118

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 2021. 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 2021. 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 - 146” by Mohammad S Anwar.


Please check out Perl solutions review of the “The Weekly Challenge - 142” 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 #146.

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

TASK #1 › Truncatable Prime

Submitted by: Mohammad S Anwar

Write a script to generate first 20 left-truncatable prime numbers in base 10.

In number theory, a left-truncatable prime is a prime number which, in a given base, contains no 0, and if the leading left digit is successively removed, then all resulting numbers are primes.


9137 is one such left-truncatable prime since 9137, 137, 37 and 7 are all prime numbers.

TASK #2 › Pentagon Numbers

Submitted by: Mohammad S Anwar

Write a script to find the first pair of Pentagon Numbers whose sum and difference are also a Pentagon Number.

Pentagon numbers can be defined as P(n) = n(3n - 1)/2.


The first 10 Pentagon Numbers are:
1, 5, 12, 22, 35, 51, 70, 92, 117 and 145.

P(4) + P(7) = 22 + 70 = 92 = P(8)
P(4) - P(7) = |22 - 70| = 48 is not a Pentagon Number.

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


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

Contact with me