I started this HW early, so I did some even numbered problems before I knew about the odd numbered only problems.
Exercise 1.9
(+ 4 5)
(if (= 4 0) 5 (inc (+ (dec 4) 5))))
(inc (+ 3 5))
(inc (if (= 3 0) 5 (inc (+ (dec 3) 5)))))
(inc (inc (+ 2 5)))
(inc (inc (if (= 2 0) 5 (inc (+ (dec 2) 5)))))
(inc (inc (inc (+ 1 5))))
(inc (inc (inc (if (= 1 0) 5 (inc (+ (dec 1) 5))))))
(inc (inc (inc (inc (+ 0 5)))))
(inc (inc (inc (inc (if (= 0 0) 5 (inc (+ (dec 0) 5)))))))
(inc (inc (inc (inc 5))))
(inc (inc (inc 6)))
(inc (inc 7))
(inc 8)
9 Recursive
(+ 4 5)
(if (= 4 0) 5 (+ (dec 4) (inc 5)))
(+ (dec 4) (inc 5)))
(+ 3 6)
(if (= 3 0) 6 (+ (dec 3) (inc 6)))
(+ (dec 3) (inc 6))
(+ 2 7)
(if (= 2 0) 7 (+ (dec 2) (inc 7)))
(+ (dec 2) (inc 7))
(+ 1 8)
(if (= 1 0) 8 (+ (dec 1 ) (inc 8)))
(+ (dec 1) (inc 8))
(+ 0 9)
(if (= 0 0) 9 (+ (dec 0) (inc 9)))
9 Iterative
Exercise 1.10
(A 1 10) = 1024
(A 2 4) = 65536
(A 3 3 ) = 65536
(f n) = 2n
(g n) = 2^n
(h n) = 2^(h (n-1))
Exercise 1.15
a) 5
b) O(log(a)) for both space and time
Exercise 1.19
??
Exercise 1.20
run forever for normal order?
4 times for applicative order
Exercise 1.21
199 -> 199
1999 -> 1999
19999 -> 7
1.23
??
Exercise 1.25
Yes, she is correct. Both methods should give the same answers. She is correct. But I don't know if this would serve well for our fast prime tester.