$$\newcommand{\mtn}{\mathbb{N}}\newcommand{\mtns}{\mathbb{N}^*}\newcommand{\mtz}{\mathbb{Z}}\newcommand{\mtr}{\mathbb{R}}\newcommand{\mtk}{\mathbb{K}}\newcommand{\mtq}{\mathbb{Q}}\newcommand{\mtc}{\mathbb{C}}\newcommand{\mch}{\mathcal{H}}\newcommand{\mcp}{\mathcal{P}}\newcommand{\mcb}{\mathcal{B}}\newcommand{\mcl}{\mathcal{L}}
\newcommand{\mcm}{\mathcal{M}}\newcommand{\mcc}{\mathcal{C}}
\newcommand{\mcmn}{\mathcal{M}}\newcommand{\mcmnr}{\mathcal{M}_n(\mtr)}
\newcommand{\mcmnk}{\mathcal{M}_n(\mtk)}\newcommand{\mcsn}{\mathcal{S}_n}
\newcommand{\mcs}{\mathcal{S}}\newcommand{\mcd}{\mathcal{D}}
\newcommand{\mcsns}{\mathcal{S}_n^{++}}\newcommand{\glnk}{GL_n(\mtk)}
\newcommand{\mnr}{\mathcal{M}_n(\mtr)}\DeclareMathOperator{\ch}{ch}
\DeclareMathOperator{\sh}{sh}\DeclareMathOperator{\th}{th}
\DeclareMathOperator{\vect}{vect}\DeclareMathOperator{\card}{card}
\DeclareMathOperator{\comat}{comat}\DeclareMathOperator{\imv}{Im}
\DeclareMathOperator{\rang}{rg}\DeclareMathOperator{\Fr}{Fr}
\DeclareMathOperator{\diam}{diam}\DeclareMathOperator{\supp}{supp}
\newcommand{\veps}{\varepsilon}\newcommand{\mcu}{\mathcal{U}}
\newcommand{\mcun}{\mcu_n}\newcommand{\dis}{\displaystyle}
\newcommand{\croouv}{[\![}\newcommand{\crofer}{]\!]}
\newcommand{\rab}{\mathcal{R}(a,b)}\newcommand{\pss}[2]{\langle #1,#2\rangle}
$$

Bibm@th
exponentiation rapide
Lorsque l'on souhaite calculer an, on peut naïvement effectuer
n-1 multiplications en faisant :
Cependant, l'exemple suivant montre que l'on peut calculer a2048 en effectuant
simplement 11 multiplication (chaque fois que l'on élève au carré) :
L'algorithme d'exponentiation rapide est la transposition au cas général de l'exemple précédent. Une version récursive
est donnée par :
- si n=0, alors an=1.
- si n=2p est pair, alors an=(ap)2.
- si n=2p+1 est impair, alors an=(ap)2×a.
Alors que l'algorithme naïf demande de l'ordre de n multiplications pour calculer an,
l'algorithme d'exponentiation rapide se contente de l'ordre de ln(n) multiplications.
En outre, tester si un entier est pair est très rapide sur un ordinateur.