Addition-chain exponentiation: Difference between revisions
Content added Content deleted
m (<lang> needs a language) |
m (→{{header|Go}}: bug fix.) |
||
Line 234: | Line 234: | ||
func dichotomic(n int) int { |
func dichotomic(n int) int { |
||
return n / (1 << uint(λ(n)/2)) |
return n / (1 << uint((λ(n)+1)/2)) |
||
} |
} |
||
Line 418: | Line 418: | ||
exponent: 853922530 |
exponent: 853922530 |
||
addition chain: [1 2 |
addition chain: [1 2 4 5 7 12 24 48 96 103 206 309 412 721 1133 1854 3708 4841 |
||
9682 19364 21218 26059 52118 104236 208472 416944 833888 1667776 3335552 6671104 |
|||
3779 4834 9668 19336 24170 48340 52119 104238 208476 416952 833904 1667808 |
|||
13342208 26684416 53368832 106737664 213475328 426950656 853901312 853922530] |
|||
3335616 6671232 13342464 26684928 53369856 106739712 213479424 426958848 |
|||
853917696 853922530] |
|||
a^e |
a^e |
||
[-0.500 0.500 -0.500 0.500 0.000 0.000] |
[-0.500 0.500 -0.500 0.500 0.000 0.000] |
||
Line 429: | Line 428: | ||
[ 0.000 0.000 0.000 0.000 1.000 0.000] |
[ 0.000 0.000 0.000 0.000 1.000 0.000] |
||
[ 0.000 0.000 0.000 0.000 0.000 1.000] |
[ 0.000 0.000 0.000 0.000 0.000 1.000] |
||
count of multiplies: |
count of multiplies: 37 |
||
exponent: 31415 |
exponent: 31415 |