Skip to content

Commit ecfa4ca

Browse files
committed
correct 2^(log n base 2) instead of 2 log n
1 parent ba62a74 commit ecfa4ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/algebra/binary-exp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Let's write $n$ in base 2, for example:
2929

3030
$$3^{13} = 3^{1101_2} = 3^8 \cdot 3^4 \cdot 3^1$$
3131

32-
Since the number $n$ has exactly $\lfloor \log_2 n \rfloor + 1$ digits in base 2, we only need to perform $O(\log n)$ multiplications, if we know the powers $a^1, a^2, a^4, a^8, \dots, a^{\lfloor \log_2 n \rfloor}$.
32+
Since the number $n$ has exactly $\lfloor \log_2 n \rfloor + 1$ digits in base 2, we only need to perform $O(\log n)$ multiplications, if we know the powers $a^1, a^2, a^4, a^8, \dots, a^{2^{\lfloor \log_2 n \rfloor}}$.
3333

3434
So we only need to know a fast way to compute those.
3535
Luckily this is very easy, since an element in the sequence is just the square of the previous element.

0 commit comments

Comments
 (0)