Skip to main content


Today I was reading about quantum computers only being able to do math that is reversible.

That means they cannot do exponents in the standard way, because a positive exponent is impossible to unwind, as the result could be positive or negative.

210 = -210 = 256

But there is a way to do it that quantum computers are fine with. Here is my python code example of it.

You'll recognize the weird nth_fib from a previous post of mine. So you could argue that this is doubly-weird.

Try it out, and let me know if you have any ideas or improvements for bibonacci_exponentiation(). Otherwise, use it to learn a new trick (as I did today).

You can cut/paste the code from the alt text so you don't have to bring out your magnifying glass to type it out manually.

Bonus if you can explain why it works.

#python #quantum #math