Submitted by DryEstablishment2 t3_zy4vh0 in explainlikeimfive
nmxt t1_j23weu9 wrote
Reply to comment by AquaRegia in ELI5: How do computers compute gigantic mathematical calculations? by DryEstablishment2
Well it’s not 72,828 multiplications, it’s something like thirty multiplications. If 2838393 is N, you first need to calculate N^2 , then N^4 as the previous result squared, then N^8 as N^4 squared etc. and then just multiply some of those power-of-two results to combine them into the required final power. For example, if you wanted to calculate 3^9, you don’t need to make 9 multiplications. You calculate 3^2, 3^4 and 3^8 (three multiplications), and then multiply 3^8 by 3 to get 3^9 (fourth multiplication).
AquaRegia t1_j23wspr wrote
Yes, and that's my point.
Viewing a single comment thread. View all comments