FrankKair / polyglot-euler

📜 Project Euler solutions in various programming languages
MIT License
74 stars 14 forks source link

Python 025 028 036 097 #73

Closed FrankKair closed 6 years ago

FrankKair commented 6 years ago

How the solution works

025 Simple Fibonacci iteration checking length of the number.

028 Wiki

036 Simple iteration filtering double base palindromes.

097 Uses modular exponentiation (pow(2, 7830457, mod)) and % mod to keep track of the last ten digits.

Performance

025

Real time: 0.078 s
User time: 0.063 s
Sys. time: 0.011 s
CPU share: 95.17 %

028

Real time: 0.036 s
User time: 0.025 s
Sys. time: 0.011 s
CPU share: 98.71 %

036

Real time: 1.096 s
User time: 1.079 s
Sys. time: 0.010 s
CPU share: 99.46 %

097

Real time: 0.037 s
User time: 0.029 s
Sys. time: 0.008 s
CPU share: 98.67 %