The simplest solution: start with 1, multiply by exactly times.
If , you compute . This takes time.
For small , this works fine. But if , you're doing a billion multiplications. That's too slow. Can you cut the work in half somehow?
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Loop n times
The simplest solution: start with 1, multiply by exactly times.
If , you compute . This takes time.
For small , this works fine. But if , you're doing a billion multiplications. That's too slow. Can you cut the work in half somehow?