Knuth's power tree: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: changed/added comments and whitespace, changed indentations, made other cosmetic changes.)
m (added whitespace, split long sentences.)
Line 1: Line 1:
{{draft task|Knuth's power tree}}
{{draft task|Knuth's power tree}}


(Used for computing &nbsp; <big>x<sup>n</sup></big> &nbsp; efficiently using Knuth's power tree.) <br>
(Knuth's power tree is used for computing &nbsp; <big><big>x<sup>n</sup></big></big> &nbsp; efficiently using Knuth's power tree.) <br>


;task requirements:

Compute and show the list of Knuth's power tree integers necessary for the computation of:

::* &nbsp; <big><big>X<sup>n</sup></big></big> &nbsp; for any real &nbsp; <big><big>X</big></big> &nbsp; and any non-negative integer &nbsp; <big>n</big>.



The requirements of this draft task are to compute and show the list of Knuth's power tree integers necessary for the computation of &nbsp;
<big>X<sup>n</sup></big> &nbsp; for any real &nbsp; <big>X</big> &nbsp; and any non-negative integer &nbsp; n.


Then, using those integers, calculate and show the exact (not approximate) value of (at least) the integer powers below:
Then, using those integers, calculate and show the exact (not approximate) value of (at least) the integer powers below:
Line 11: Line 17:
::* &nbsp; <big>3<sup>191</sup></big>
::* &nbsp; <big>3<sup>191</sup></big>
::* &nbsp; <big>1.1<sup>81</sup></big>
::* &nbsp; <big>1.1<sup>81</sup></big>



A zero power is often handled separately as a special case.
A zero power is often handled separately as a special case.


Optionally, support negative integers (for the power).
Optionally, support negative integers &nbsp; (for the power).


;example:


An example of a small power tree for some low integers:
An example of a small power tree for some low integers:
Line 72: Line 82:


See: &nbsp; link to Rosetta Code &nbsp; [http://rosettacode.org/wiki/Addition-chain_exponentiation addition-chain exponentiation].
See: &nbsp; link to Rosetta Code &nbsp; [http://rosettacode.org/wiki/Addition-chain_exponentiation addition-chain exponentiation].
<br>
<br><br>


=={{header|EchoLisp}}==
=={{header|EchoLisp}}==