diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-12-04 11:10:17 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-12-04 11:10:17 +0000 |
| commit | a5142150602b78793af374bf2e1e4c6f2644cca9 (patch) | |
| tree | 9da1aceb3918a764b5f9d5579a0de8567aea9300 | |
| parent | 2fc5bc743f2ba88415e5d7c1d25be74c0d046ce5 (diff) | |
| download | perlweeklychallenge-club-a5142150602b78793af374bf2e1e4c6f2644cca9.tar.gz perlweeklychallenge-club-a5142150602b78793af374bf2e1e4c6f2644cca9.tar.bz2 perlweeklychallenge-club-a5142150602b78793af374bf2e1e4c6f2644cca9.zip | |
- Added solutions by Jan Krnavek.
- Added solutions by W. Luis Mochan.
- Added solutions by David Ferrone.
- Added solutions by Luca Ferrari.
| -rwxr-xr-x | challenge-246/eric-cheung/python/ch-1.py | 17 | ||||
| -rwxr-xr-x | challenge-246/eric-cheung/python/ch-2.py | 71 | ||||
| -rw-r--r-- | stats/pwc-challenge-245.json | 646 | ||||
| -rw-r--r-- | stats/pwc-current.json | 610 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 70 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1653 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 726 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 28 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 48 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 100 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 126 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 34 | ||||
| -rw-r--r-- | stats/pwc-summary-271-300.json | 34 | ||||
| -rw-r--r-- | stats/pwc-summary-301-330.json | 54 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 52 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 116 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 102 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 660 |
19 files changed, 2707 insertions, 2480 deletions
diff --git a/challenge-246/eric-cheung/python/ch-1.py b/challenge-246/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..5ad578ad8b --- /dev/null +++ b/challenge-246/eric-cheung/python/ch-1.py @@ -0,0 +1,17 @@ +
+from random import randint
+
+nMaxNum = 49
+nNumChosen = 6
+
+arrInput = list(range(1, nMaxNum + 1))
+arrOuput = []
+
+for nLoop in range(nNumChosen):
+ nIndx = randint(0, nMaxNum - nLoop)
+ arrOuput.append(arrInput[nIndx])
+ del arrInput[nIndx]
+
+arrOuput.sort()
+
+print (arrOuput)
diff --git a/challenge-246/eric-cheung/python/ch-2.py b/challenge-246/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..efbbb54bbb --- /dev/null +++ b/challenge-246/eric-cheung/python/ch-2.py @@ -0,0 +1,71 @@ +
+## Ref.
+## https://math.libretexts.org/Courses/Mount_Royal_University/MATH_2150%3A_Higher_Arithmetic/5%3A_Diophantine_Equations/5.1%3A_Linear_Diophantine_Equations#:~:text=A%20Linear%20Diophantine%20equation%20(LDE,and%20y%20are%20unknown%20variables.
+## https://stackoverflow.com/questions/59168914/finding-solutions-to-diophantine
+
+from math import gcd
+import sys
+
+
+def IsConsecutiveEven (arrNum):
+ for nIndx in range(0, len(arrNum) - 1):
+ if arrNum[nIndx] % 2 == 0 and arrNum[nIndx + 1] % 2 == 0:
+ return nIndx
+ return -1
+
+
+def DotProduct (arrNum_01, arrNum_02):
+ return sum(arrLoop[0] * arrLoop[1] for arrLoop in zip(arrNum_01, arrNum_02))
+
+
+def ModifiedGCD (arrNum, arrParam):
+ if arrNum[1] == 0:
+ return [arrNum[0], 1, 0]
+
+ nX = 0
+ nY = 0
+
+ nDiv, nX, nY = ModifiedGCD([arrNum[1], arrNum[0] % arrNum[1]], [nX, nY])
+ return [nDiv, nY, nX - nY * (arrNum[0] // arrNum[1])]
+
+arrInput = [1, 1, 2, 3, 5] ## Example 1
+## arrInput = [4, 2, 4, 5, 7] ## Example 2
+## arrInput = [4, 1, 2, -3, 8] ## Example 3
+
+
+## print (ModifiedGCD(arrInput[0:2], [0, 0]))
+## print (ModifiedGCD([47, 30], [0, 0]))
+
+nConsecutiveEvenIndx = IsConsecutiveEven (arrInput)
+if nConsecutiveEvenIndx > -1:
+ arrContainOdd = [nIndx for nIndx in range(nConsecutiveEvenIndx + 2, len(arrInput)) if arrInput[nIndx] % 2 == 1]
+ if len(arrContainOdd) > 0:
+ print (False)
+ sys.exit()
+
+nGCD = gcd (arrInput[0], arrInput[1])
+if arrInput[2] % nGCD != 0:
+ print (False)
+ sys.exit()
+
+arrParam = []
+
+## ==== To Be Further Fine Tune ====
+if arrInput[2] == arrInput[0] + arrInput[1]:
+ arrParam.append(1)
+ arrParam.append(1)
+elif arrInput[2] == arrInput[0] - 2 * arrInput[1]:
+ arrParam.append(1)
+ arrParam.append(-2)
+## ==== To Be Further Fine Tune ====
+
+if len(arrParam) == 0:
+ print (False)
+ sys.exit()
+
+for nIndx in range(3, 5):
+ if arrInput[nIndx] != DotProduct(arrParam, arrInput[nIndx - 2 : nIndx]):
+ print (False)
+ sys.exit()
+
+print (True)
diff --git a/stats/pwc-challenge-245.json b/stats/pwc-challenge-245.json new file mode 100644 index 0000000000..c9edc75c61 --- /dev/null +++ b/stats/pwc-challenge-245.json @@ -0,0 +1,646 @@ +{ + "title" : { + "text" : "The Weekly Challenge - 245" + }, + "xAxis" : { + "type" : "category" + }, + "legend" : { + "enabled" : 0 + }, + "drilldown" : { + "series" : [ + { + "id" : "Adam Russell", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "name" : "Adam Russell" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Ali Moradi", + "name" : "Ali Moradi" + }, + { + "name" : "Arne Sommer", + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Arne Sommer" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "Athanasius", + "name" : "Athanasius" + }, + { + "name" : "BarrOff", + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 1 + ] + ], + "id" : "BarrOff" + }, + { + "name" : "Bob Lied", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Bob Lied" + }, + { + "name" : "Bruce Gray", + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Bruce Gray" + }, + { + "id" : "Cheok-Yin Fung", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Cheok-Yin Fung" + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Clifton Wood", + "name" : "Clifton Wood" + }, + { + "id" : "Dave Jacoby", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Dave Jacoby" + }, + { + "name" : "David Ferrone", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "David Ferrone" + }, + { + "id" : "E. Choroba", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "E. Choroba" + }, + { + "name" : "Humberto Massa", + "id" : "Humberto Massa", + "data" : [ + [ + "Raku", + 2 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Ian Rifkin", + "name" : "Ian Rifkin" + }, + { + "name" : "Jan Krnavek", + "id" : "Jan Krnavek", + "data" : [ + [ + "Raku", + 1 + ] + ] + }, + { + "name" : "Jorg Sommrey", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Jorg Sommrey" + }, + { + "name" : "Laurent Rosenfeld", + "data" : [ + [ + "Perl", + 1 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 2 + ] + ], + "id" : "Laurent Rosenfeld" + }, + { + "name" : "Lubos Kolouch", + "id" : "Lubos Kolouch", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { + "name" : "Luca Ferrari", + "id" : "Luca Ferrari", + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 9 + ] + ] + }, + { + "name" : "Mariano Spadaccini", + "id" : "Mariano Spadaccini", + "data" : [ + [ + "Perl", + 1 + ] + ] + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Mark Anderson", + "name" : "Mark Anderson" + }, + { + "name" : "Matthew Neleigh", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Matthew Neleigh" + }, + { + "name" : "Nelo Tovar", + "id" : "Nelo Tovar", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "name" : "Niels van Dijke", + "id" : "Niels van Dijke", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "name" : "Packy Anderson", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Packy Anderson" + }, + { + "id" : "Paulo Custodio", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Paulo Custodio" + }, + { + "name" : "Peter Campbell Smith", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Peter Campbell Smith" + }, + { + "name" : "Peter Meszaros", + "id" : "Peter Meszaros", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "name" : "Robbie Hatley", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Robbie Hatley" + }, + { + "name" : "Robert Ransbottom", + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Robert Ransbottom" + }, + { + "name" : "Roger Bell_West", + "id" : "Roger Bell_West", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { + "id" : "Thomas Kohler", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "name" : "Thomas Kohler" + }, + { + "name" : "Ulrich Rieke", + "id" : "Ulrich Rieke", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan" + } + ] + }, + "series" : [ + { + "data" : [ + { + "y" : 4, + "drilldown" : "Adam Russell", + "name" : "Adam Russell" + }, + { + "drilldown" : "Ali Moradi", + "y" : 3, + "name" : "Ali Moradi" + }, + { + "name" : "Arne Sommer", + "y" : 3, + "drilldown" : "Arne Sommer" + }, + { + "name" : "Athanasius", + "drilldown" : "Athanasius", + "y" : 4 + }, + { + "y" : 2, + "drilldown" : "BarrOff", + "name" : "BarrOff" + }, + { + "name" : "Bob Lied", + "drilldown" : "Bob Lied", + "y" : 2 + }, + { + "drilldown" : "Bruce Gray", + "y" : 2, + "name" : "Bruce Gray" + }, + { + "drilldown" : "Cheok-Yin Fung", + "y" : 2, + "name" : "Cheok-Yin Fung" + }, + { + "drilldown" : "Clifton Wood", + "y" : 2, + "name" : "Clifton Wood" + }, + { + "drilldown" : "Dave Jacoby", + "y" : 3, + "name" : "Dave Jacoby" + }, + { + "y" : 2, + "drilldown" : "David Ferrone", + "name" : "David Ferrone" + }, + { + "y" : 2, + "drilldown" : "E. Choroba", + "name" : "E. Choroba" + }, + { + "name" : "Humberto Massa", + "drilldown" : "Humberto Massa", + "y" : 2 + }, + { + "name" : "Ian Rifkin", + "y" : 3, + "drilldown" : "Ian Rifkin" + }, + { + "name" : "Jan Krnavek", + "y" : 1, + "drilldown" : "Jan Krnavek" + }, + { + "y" : 3, + "drilldown" : "Jorg Sommrey", + "name" : "Jorg Sommrey" + }, + { + "drilldown" : "Laurent Rosenfeld", + "y" : 5, + "name" : "Laurent Rosenfeld" + }, + { + "name" : "Lubos Kolouch", + "drilldown" : "Lubos Kolouch", + "y" : 5 + }, + { + "name" : "Luca Ferrari", + "y" : 11, + "drilldown" : "Luca Ferrari" + }, + { + "y" : 1, + "drilldown" : "Mariano Spadaccini", + "name" : "Mariano Spadaccini" + }, + { + "name" : "Mark Anderson", + "y" : 2, + "drilldown" : "Mark Anderson" + }, + { + "name" : "Matthew Neleigh", + "drilldown" : "Matthew Neleigh", + "y" : 2 + }, + { + "name" : "Nelo Tovar", + "y" : 2, + "drilldown" : "Nelo Tovar" + }, + { + "y" : 2, + "drilldown" : "Niels van Dijke", + "name" : "Niels van Dijke" + }, + { + "y" : 5, + "drilldown" : "Packy Anderson", + "name" : "Packy Anderson" + }, + { + "name" : "Paulo Custodio", + "drilldown" : "Paulo Custodio", + "y" : 2 + }, + { + "name" : "Peter Campbell Smith", + "y" : 3, + "drilldown" : "Peter Campbell Smith" + }, + { + "drilldown" : "Peter Meszaros", + "y" : 2, + "name" : "Peter Meszaros" + }, + { + "drilldown" : "Robbie Hatley", + "y" : 3, + "name" : "Robbie Hatley" + }, + { + "drilldown" : "Robert Ransbottom", + "y" : 2, + "name" : "Robert Ransbottom" + }, + { + "drilldown" : "Roger Bell_West", + "y" : 5, + "name" : "Roger Bell_West" + }, + { + "drilldown" : "Thomas Kohler", + "y" : 4, + "name" : "Thomas Kohler" + }, + { + "name" : "Ulrich Rieke", + "drilldown" : "Ulrich Rieke", + "y" : 4 + }, + { + "name" : "W. Luis Mochan", + "y" : 3, + "drilldown" : "W. Luis Mochan" + } + ], + "name" : "The Weekly Challenge - 245", + "colorByPoint" : 1 + } + ], + "subtitle" : { + "text" : "[Champions: 34] Last updated at 2023-12-04 11:03:32 GMT" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "chart" : { + "type" : "column" + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + }, + "tooltip" : { + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", + "followPointer" : 1, + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>" + } +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index ab08990493..b518c2501e 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,147 +1,32 @@ { - "tooltip" : { - "followPointer" : 1, - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", - "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" - }, "plotOptions" : { "series" : { - "borderWidth" : 0, "dataLabels" : { "enabled" : 1, "format" : "{point.y}" - } + }, + "borderWidth" : 0 } }, + "xAxis" : { + "type" : "category" + }, + "title" : { + "text" : "The Weekly Challenge - 246" + }, + "legend" : { + "enabled" : 0 + }, + "tooltip" : { + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", + "followPointer" : 1, + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>" + }, "drilldown" : { "series" : [ { - "id" : "Adam Russell", - "name" : "Adam Russell", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 2 - ] - ] - }, - { - "id" : "Ali Moradi", - "name" : "Ali Moradi", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ] - }, - { - "data" : [ - [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ], - "name" : "Arne Sommer", - "id" : "Arne Sommer" - }, - { - "name" : "Athanasius", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ] - ], - "id" : "Athanasius" - }, - { - "id" : "BarrOff", - "data" : [ - [ - "Perl", - 1 - ], - [ - "Raku", - 1 - ] - ], - "name" : "BarrOff" - }, - { - "data" : [ - [ - "Perl", - 2 - ] - ], - "name" : "Bob Lied", - "id" : "Bob Lied" - }, - { - "id" : "Bruce Gray", - "data" : [ - [ - "Raku", - 2 - ] - ], - "name" : "Bruce Gray" - }, - { - "name" : "Cheok-Yin Fung", - "data" : [ - [ - "Perl", - 2 - ] - ], - "id" : "Cheok-Yin Fung" - }, - { - "data" : [ - [ - "Raku", - 2 - ] - ], - "name" : "Clifton Wood", - "id" : "Clifton Wood" - }, - { - "id" : "Dave Jacoby", - "name" : "Dave Jacoby", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ] - }, - { - "id" : "David Ferrone", "name" : "David Ferrone", + "id" : "David Ferrone", "data" : [ [ "Perl", @@ -150,277 +35,22 @@ ] }, { - "id" : "E. Choroba", - "name" : "E. Choroba", - "data" : [ - [ - "Perl", - 2 - ] - ] - }, - { - "id" : "Humberto Massa", - "data" : [ - [ - "Raku", - 2 - ] - ], - "name" : "Humberto Massa" - }, - { - "id" : "Ian Rifkin", - "name" : "Ian Rifkin", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ] - }, - { - "name" : "Jorg Sommrey", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Jorg Sommrey" - }, - { - "data" : [ - [ - "Perl", - 1 - ], - [ - "Raku", - 2 - ], - [ - "Blog", - 2 - ] - ], - "name" : "Laurent Rosenfeld", - "id" : "Laurent Rosenfeld" - }, - { - "id" : "Lubos Kolouch", - "name" : "Lubos Kolouch", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ] - }, - { "id" : "Luca Ferrari", - "name" : "Luca Ferrari", - "data" : [ - [ - "Raku", - 2 - ], - [ - "Blog", - 9 - ] - ] - }, - { - "name" : "Mariano Spadaccini", - "data" : [ - [ - "Perl", - 1 - ] - ], - "id" : "Mariano Spadaccini" - }, - { - "data" : [ - [ - "Raku", - 2 - ] - ], - "name" : "Mark Anderson", - "id" : "Mark Anderson" - }, - { - "id" : "Matthew Neleigh", "data" : [ [ - "Perl", - 2 - ] - ], - "name" : "Matthew Neleigh" - }, - { - "id" : "Nelo Tovar", - "name" : "Nelo Tovar", - "data" : [ - [ - "Perl", - 2 - ] - ] - }, - { - "id" : "Niels van Dijke", - "data" : [ - [ - "Perl", - 2 - ] - ], - "name" : "Niels van Dijke" - }, - { - "data" : [ - [ - "Perl", - 2 - ], - [ "Raku", 2 ], [ "Blog", - 1 - ] - |
