aboutsummaryrefslogtreecommitdiff
path: root/challenge-123/duncan-c-white/README
blob: b7d8d96453092d63903425f0ef6006431319b435 (plain)
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
Task 1: "Ugly Numbers

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.

Example

	Input: $n = 7
	Output: 8

	Input: $n = 10
	Output: 12
"

My notes: sounds quite simple.  I thought of digging out primes and
factors code from previous PWCs, but the only primes we care about are
2, 3 and 5.


Task 2: "Square Points

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.

Example

	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.
"

My notes: sounds surprisingly easy for a task 2.  I guess the points
can be in any order.