Originally Posted by
dh214 Devise a recursive algorithm to find a^(2^n) n where a is a real number and n
is a positive integer.
This is a bit tricky
Only for small values of tricky.
$\displaystyle a^{2^n}=(a^{2^{n-1}})^2$
so:
Code:
function aToThe2n(a,n)
if n==1
rv=a^2
else
rv=(aToThe2n(a,n-1))^2
endif
return rv
endfunction
CB