aboutsummaryrefslogtreecommitdiff
path: root/challenge-013/duncan-c-white/README
blob: 818ecf50b2e75dda4ba1ec111ef9ba0bed2ba3d5 (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
Challenge 1: "Write a script to print the date of last Friday of every
month of a given year. For example, if the given year is 2019 then it
should print the following:

2019/01/25
2019/02/22
2019/03/29
2019/04/26
2019/05/31
2019/06/28
2019/07/26
2019/08/30
2019/09/27
2019/10/25
2019/11/29
2019/12/27


My notes:

Date::Manip should be able to do that easily enough.


Challenge 2: Write a script to demonstrate Mutually Recursive methods. Two
methods are mutually recursive if the first method calls the second and
the second calls first in turn. Using the mutually recursive methods,
generate Hofstadter Female and Male sequences.

 F ( 0 ) = 1   ;   M ( 0 ) = 0
 F ( n ) = n - M ( F ( n - 1 ) ) , n > 0
 M ( n ) = n - F ( M ( n - 1 ) ) , n > 0."


 My notes:

 Ok, looks straight forward enough, and I always liked Douglas Hofstadter
 and especially his book Godel, Esher and Bach.  Initially, I did it as
 straightforward mutually recursive functions, but then I added Memoize
 optimization when I realized how slow it gets as N increases (eg to 80..)..