Addition-chain exponentiation: Difference between revisions

Content added Content deleted
Line 530: Line 530:
--?addition_chain(27182,19) -- bust
--?addition_chain(27182,19) -- bust
--?addition_chain(27182,18) -- bust</pre>
--?addition_chain(27182,18) -- bust</pre>
Once you have an addition chain, of course, apply it as per [[Knuth%27s_power_tree#Phix]]
Once you have an addition chain, of course, apply it as per [[Knuth%27s_power_tree#Phix]], and of course length(pn) is the number of multiplies that will perform.
<pre>--sequence pn = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,24576,28672,30720,31232,31360,31392,31408,31412,31414,31415}
<pre>--sequence pn = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,24576,28672,30720,31232,31360,31392,31408,31412,31414,31415}
--sequence pn = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,10240,10368,10384,10386,20772,31158,31414,31415}
--sequence pn = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,10240,10368,10384,10386,20772,31158,31414,31415}