Zgjidh çdo problem matematikor
Ekuacionet, derivatet, integralet, matricat, trekëndëshat, numrat e parë, statistikat, ose një problem fjalësh që mësuesi i ndanë në pjesë.
Hap pas hapi
- 2^{1000} \bmod 13
Never compute the huge power. Reduce after every multiplication (repeated squaring).
- 2 \equiv 2 \pmod{13}
Reduce the base first.
- 1000 = 1111101000_2
Write the exponent in binary: 10 squarings at most.
- 2^2 \equiv 4 \pmod{13}
Square the running power.
- 4^2 \equiv 3 \pmod{13}
Square the running power.
- 3^2 \equiv 9 \pmod{13}
Square the running power.
- r \leftarrow r \cdot 9 \equiv 9 \pmod{13}
This bit is 1: multiply the result by the current power.
- 9^2 \equiv 3 \pmod{13}
Square the running power.
- 3^2 \equiv 9 \pmod{13}
Square the running power.
- r \leftarrow r \cdot 9 \equiv 3 \pmod{13}
This bit is 1: multiply the result by the current power.
- 9^2 \equiv 3 \pmod{13}
Square the running power.
- r \leftarrow r \cdot 3 \equiv 9 \pmod{13}
This bit is 1: multiply the result by the current power.
- 3^2 \equiv 9 \pmod{13}
Square the running power.
- r \leftarrow r \cdot 9 \equiv 3 \pmod{13}
This bit is 1: multiply the result by the current power.
- 9^2 \equiv 3 \pmod{13}
Square the running power.
- r \leftarrow r \cdot 3 \equiv 9 \pmod{13}
This bit is 1: multiply the result by the current power.
- 3^2 \equiv 9 \pmod{13}
Square the running power.
- r \leftarrow r \cdot 9 \equiv 3 \pmod{13}
This bit is 1: multiply the result by the current power.
- \vdots
Same pattern for the remaining bits.
- 2^{1000} \equiv 3 \pmod{13}
Done.