The Weekly Challenge - 290

Monday, Oct 7, 2024| Tags: Perl, Raku

TABLE OF CONTENTS


01. HEADLINES

02. SPONSOR

03. RECAP

04. PERL REVIEW

05. RAKU REVIEW

06. CHART

07. NEW MEMBERS

08. GUESTS

09. TASK #1: Double Exist

10. TASK #2: Luhn’s Algorithm


HEADLINES


Welcome to the Week #290 of The Weekly Challenge.

Today is the first Monday of the month and time to declare our next champion. With great pride, I announce Roger Bell_West as our next champion. Thank you, Roger for your support and encouragements. I will be in touch with you in the next few days with regard to the prize money.

It has been very busy week for me personally as you must have noticed in delay of processing your contributions. Start of October always bring negativity around me. In the past also, it stays most of the time way past end of March. I thought I was fully prepared this time unlike last 2 years but …

I hope you are having fun with Hacktoberfest. Keep contributing to the weekly challenge or any other open source codebase of your choice.


Last 5 weeks mainstream contribution stats. Thank you Team PWC for your support and encouragements.

  Week      Perl       Raku       Blog   
   285       61       23       18   
   286       59       25       20   
   287       52       25       28   
   288       42       18       17   
   289       64       26       31   

Last 5 weeks guest contribution stats. Thank you each and every guest contributors for your time and efforts.

  Week      Guests       Contributions       Languages   
   285       17       72       25   
   286       14       50       21   
   287       14       63       19   
   288       10       46       16   
   289       18       72       24   

TOP 10 Guest Languages


Do you see your favourite language in the Top #10? If not then why not contribute regularly and make it to the top.

 1. Python     (2960)
 2. Rust       (764)
 3. Ruby       (732)
 4. Haskell    (711)
 5. Lua        (645)
 6. C          (587)
 7. C++        (551)
 8. JavaScript (495)
 9. Go         (416)
10. BQN        (376)

Blogs with Creative Title


1. Maximum Jumble by Adam Russell.

2. Data Transformations: Third Maximum and Jumbled Letters by Andre Ploger.

3. Jumbled Third by Arne Sommer.

4. Irregular Use of Regular Expressions by Dave Jacoby.

5. The Third Jumble by Jorg Sommrey.

6. Arrays Everywhere! by Luca Ferrari.

7. The Mxamium Jmubled Wkeely Chllaegne by Matthias Muth.

8. Tirhd Mumixam Prel Welkey Caelhlnge by Packy Anderson.

9. Big ones and jelmbud wrods by Peter Campbell Smith.

10. Maximum Jumble by Roger Bell_West.

11. 3rd Maximum and Jbmueld Wrods by Ryan Thompson.

12. Functional Solutions by Tim King.


GitHub Repository Stats


1. Commits: 40,596 (+132)

2. Pull Requests: 10,961 (+52)

3. Contributors: 254

4. Fork: 320

5. Stars: 175



With start of Week #268, we have a new sponsor Lance Wicks for the entire year 2024. Having said we are looking for more sponsors so that we can go back to weekly winner. If anyone interested please get in touch with us at perlweeklychallenge@yahoo.com. Thanks for your support in advance.


RECAP


Quick recap of The Weekly Challenge - 289 by Mohammad Sajid Anwar.


PERL REVIEW


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


RAKU REVIEW


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


CHART


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.


NEW MEMBERS


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.


GUESTS


Please check out the guest contributions for the Week #289.

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


Task 1: Double Exist

Submitted by: Mohammad Sajid Anwar

You are given an array of integers, @ints.

Write a script to find if there exist two indices $i and $j such that:

1) $i != $j
2) 0 <= ($i, $j) < scalar @ints
3) $ints[$i] == 2 * $ints[$j]

Example 1

Input: @ints = (6, 2, 3, 3)
Output: true

For $i = 0, $j = 2
$ints[$i] = 6 => 2 * 3 =>  2 * $ints[$j]

Example 2

Input: @ints = (3, 1, 4, 13)
Output: false

Example 3

Input: @ints = (2, 1, 4, 2)
Output: true

For $i = 2, $j = 3
$ints[$i] = 4 => 2 * 2 =>  2 * $ints[$j]

Task 2: Luhn’s Algorithm

Submitted by: Andrezgz

You are given a string $str containing digits (and possibly other characters which can be ignored). The last digit is the payload; consider it separately. Counting from the right, double the value of the first, third, etc. of the remaining digits.

For each value now greater than 9, sum its digits.

The correct check digit is that which, added to the sum of all values, would bring the total mod 10 to zero.

Return true if and only if the payload is equal to the correct check digit.

It was originally posted on reddit.

Example 1

Input: "17893729974"
Output: true

Payload is 4.

Digits from the right:

7 * 2 = 14, sum = 5
9 = 9
9 * 2 = 18, sum = 9
2 = 2
7 * 2 = 14, sum = 5
3 = 3
9 * 2 = 18, sum = 9
8 = 8
7 * 2 = 14, sum = 5
1 = 1

Sum of all values = 56, so 4 must be added to bring the total mod 10 to zero. The payload is indeed 4.

Example 2

Input: "4137 8947 1175 5904"
Output: true

Example 3

Input: "4137 8974 1175 5904"
Output: false


Last date to submit the solution 23:59 (UK Time) Sunday 13th October 2024.


SO WHAT DO YOU THINK ?

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

Contact with me