Name:
Anonymous
2023-06-15 21:13
Given the function `f` defined as:
f(0) = 2
f(N) = f(N-1) ** f(N-1)
calculate `f(5)`
Name:
Anonymous
2023-06-17 14:16
f(5) = f(4) ** f(4)
f(4) = f(3) ** f(3)
f(3) = f(2) ** f(2)
f(2) = f(1) ** f(1)
f(1) = f(0) ** f(0)
f(0) = 2
f(1) = 2 ** 2 = 4
f(2) = 4 ** 4 = 256
f(3) = 256 ** 256 = (2 ** 8) ** 256 = 2 ** 2048
f(4) = (2 ** 2048) ** (2 ** 2048) = 2 ** (2048 * (2 ** 2048) = 2 ** ((2 ** 11)*(2 ** 2048)) = 2 ** (2 ** 2059)
f(5) = (2 ** (2 ** 2059)) ** (2 ** (2 ** 2059)) = 2 ** ((2 ** 2059)*(2 ** (2 ** 2059))) = 2 ** (2 ** (2059 + (2 ** 2059)))
scheme@(guile-user)> (expt 2 (expt 2 (+ 2059 (expt 2 2059))))
ERROR: Throw to key `numerical-overflow' with args `("integer-expt" "Numerical overflow" #f #f)'.