- #1
evinda
Gold Member
MHB
- 3,836
- 0
Hello! (Wave)
It is stated in my notes that the calculation of $a^{n-1} \pmod{n}$ by fast exponentiation takes $O(\log{n})$ arithmetic operations and $O((\log{n})^3)$ bit operations.By using fast exponentiation, in order to calculate $a^{n-1} \pmod{n}$ we write $n-1$ as $n-1=n_0+2 n_1+ \dots+ 2^k n_k$.
We calculate $a^2, (a^2)^2, \dots, (a^{2^{k-1}})^2$.
Does each calculation $b^2$, where $b=a^{2^{j}}$, require time $\log^2n$ and since we make $k \leq \log{(n-1)}\leq \log{n}$ operations, we need totally $O(\log^3 n)$ time?
Is the time complexity needed equal to the number of bit operations?
It is stated in my notes that the calculation of $a^{n-1} \pmod{n}$ by fast exponentiation takes $O(\log{n})$ arithmetic operations and $O((\log{n})^3)$ bit operations.By using fast exponentiation, in order to calculate $a^{n-1} \pmod{n}$ we write $n-1$ as $n-1=n_0+2 n_1+ \dots+ 2^k n_k$.
We calculate $a^2, (a^2)^2, \dots, (a^{2^{k-1}})^2$.
Does each calculation $b^2$, where $b=a^{2^{j}}$, require time $\log^2n$ and since we make $k \leq \log{(n-1)}\leq \log{n}$ operations, we need totally $O(\log^3 n)$ time?
Is the time complexity needed equal to the number of bit operations?