#	Compute optimal addition chain
ac1 := proc(n)
local i;
option remember;
if n<2 then 0
elif imodp(n,2)=0 then ac1( iquo(n,2) ) + 1
else	n+2;
	for i from iquo(n,2)+1 to n-1 do
		if ac2(n-i,i)<" then ac2(n-i,i) fi od;
	"
	fi
end;

ac2 := proc( n1, n2 )	#	Addition chain of two elements
local i;
option remember;
if n2<n1 then ac2(n2,n1)
elif n1<2 then ac1(n2)
elif
