Efficient Exponentiation

Publié le: 01 mai 2021
sur la chaîne: mCoding
118,785
5.1k

How many multiplys does it take to compute x^n?

It may be fewer than you think! Worried that calling x ** 15 "slow" is not correct? Don't worry, I tested!

In[4]: timeit.timeit("100000 ** 15")
Out[4]: 0.3686526000000043
In[5]: timeit.timeit("pow_15_minimal(100000)", globals=globals())
Out[5]: 0.3275107000000048

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosS...
Project Euler: https://projecteuler.net/problem=122
Addition Chains: https://graal.ens-lyon.fr/~yrobert/al...
Compiler Explorer: https://godbolt.org/z/qeG1e3jdP

SUPPORT ME ⭐
---------------------------------------------------
Patreon:   / mcoding  
Paypal: https://www.paypal.com/donate/?hosted...
Other donations: https://mcoding.io/donate

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord:   / discord  
Github: https://github.com/mCodingLLC/
Reddit:   / mcoding  
Facebook:   / james.mcoding  


Sur cette page du site, vous pouvez voir la vidéo en ligne Efficient Exponentiation durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur mCoding 01 mai 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 118,785 fois et il a aimé 5.1 mille téléspectateurs. Bon visionnage!