To raise a number to the 13th power you do not need twelve multiplications. Write the exponent in binary and square repeatedly, multiplying in the base only where a bit is set: b⁹ = ((b²)²…), folding the exponent one bit at a time. Thirteen collapses to about four squarings — O(log n) instead of O(n). The same idea powers modular exponentiation, the engine under RSA and Diffie-Hellman, where n has hundreds of bits and the naive loop would never finish. It is over two thousand years old: Pingala used it for Sanskrit meter.
The demo computes 3^13 by squaring vs by the naive 13-multiply loop, and shows both reach 1594323 — one in far fewer multiplies: live demo
“b^n is n multiplications.” — it is about log₂n squarings; the exponent’s binary digits pick which squares to keep. cited
The exponent read in binary, folded by squaring — log-many steps to the same power. resource
On the canonical compiler, 3^13 by squaring and by the naive 13-step loop both return 1594323: