Exercise 1.9
(+ 4 5)(inc (+ 3 5 ))
(inc (inc (+ 2 5 )))
(inc (inc (inc (+ 1 5 ))))
(inc (inc (inc (inc (+ 0 5)))))
(inc (inc (inc (inc ( 5 ))))))
(inc( inc( inc( 6 ))))
(inc (inc ( 7 ))
(inc ( 8 ))
9
(+ 4 5)
(+ 3 6)
(+ 2 7)
(+ 1 8)
(+ 0 9)
As it maintains it's state through arguments only.
Exercise 1.10
1024
65536
65536
f(n) = 2 * n
g(n) = 2^n
h(n) = 2^(h(n-1)) Where n > 1
Example:
h(0) = 0
h(1) = 2^(0)) != 2 //Should be 1
h(2) = 2^(2) = 4
h(3) = 2^(4) = 16
h(4) = 2^(16) = 65536
Exercise 1.13
Could not solve but good solution here.
http://www.billthelizard.com/2009/12/sicp-exercise-113-fibonacci-and-golden.html
Exercise 1.15
a. 5 times
b. Appears to log O(log(a)) as doubling the input angle appears to increase the number of calls a constant amount.
The space appears to also be O(log(a)) the angle is roughly halved through each recursive call.
Exercise 1.19
Could not solve.
Exercise 1.21
199
1999
7
Exercise 1.22
1009
1013
1019
10007
10009
10037
100003
100019
100043
1000003
1000033
1000037
Could not verify time, runtime did not work in DrScheme and the only thing that did, (current-inexact-milliseconds) displayed -0.0009765625 for every type of input.
Exercise 1.25
This can produce the same results. Though becomes incredibly slow on large numbers and isn't as suited as a fast prime tester. But I'm not entirely sure why.