1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# Solutions by Abigail
## [Ugly Numbers][task1]
> You are given an integer `$n >= 1`.
>
> Write a script to find the $nth element of Ugly Numbers.
>
> > Ugly numbers are those number whose prime factors are `2`, `3` or `5`.
> > For example, the first 10 Ugly Numbers are `1`, `2`, `3`, `4`, `5`,
> > `6`, `8`, `9`, `10`, `12`.
### Examples
~~~~
Input: $n = 7
Output: 8
Input: $n = 10
Output: 12
~~~~
### Solutions
* [AWK](awk/ch-1.awk)
* [Bash](bash/ch-1.sh)
* [bc](bc/ch-1.bc)
* [C](c/ch-1.c)
* [Go](go/ch-1.go)
* [Java](java/ch-1.java)
* [Lua](lua/ch-1.lua)
* [Node.js](node/ch-1.js)
* [Pascal](pascal/ch-1.p)
* [Perl](perl/ch-1.pl)
* [Python](python/ch-1.py)
* [R](r/ch-1.r)
* [Ruby](ruby/ch-1.rb)
* [Scheme](scheme/ch-1.scm)
* [Tcl](tcl/ch-1.tcl)
### Blog
[Perl Weekly Challenge 123: Ugly Numbers][blog1]
## [Square Points][task2]
> You are given coordinates of four points i.e. `(x1, y1)`, `(x2, y2)`,
> `(x3, y3)` and `(x4, y4)`.
>
> Write a script to find out if the given four points form a square.
### Examples
~~~~
Input: x1 = 10, y1 = 20
x2 = 20, y2 = 20
x3 = 20, y3 = 10
x4 = 10, y4 = 10
Output: 1 as the given coordinates form a square.
~~~~
~~~~
Input: x1 = 12, y1 = 24
x2 = 16, y2 = 10
x3 = 20, y3 = 12
x4 = 18, y4 = 16
Output: 0 as the given coordinates doesn't form a square.
~~~~
### Solutions
* [AWK](awk/ch-2.awk)
* [Bash](bash/ch-2.sh)
* [bc](bc/ch-2.bc)
* [C](c/ch-2.c)
* [Go](go/ch-2.go)
* [Java](java/ch-2.java)
* [Lua](lua/ch-2.lua)
* [Node.js](node/ch-2.js)
* [Pascal](pascal/ch-2.p)
* [Perl](perl/ch-2.pl)
* [Python](python/ch-2.py)
* [R](r/ch-2.r)
* [Ruby](ruby/ch-2.rb)
* [Scheme](scheme/ch-2.scm)
* [Tcl](tcl/ch-2.tcl)
### Blog
[Perl Weekly Challenge 123: Square Points][blog2]
[task1]: https://perlweeklychallenge.org/blog/perl-weekly-challenge-123/#TASK1
[task2]: https://perlweeklychallenge.org/blog/perl-weekly-challenge-123/#TASK2
[blog1]: https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-123-1.html
[blog2]: https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-123-2.html
|