When running a complex Python program that takes quite a long time to execute, you might want to improve its execution time. But how? First of all, you need the tools to detect the bottlenecks of your code, i.e. which parts take longer to execute. This way, you can concentrate in speeding these parts first. And…
Tag: Python Scripts
Python recursive function to find the nth Fibonacci number
Today, a short post with a Python recursive function that finds the nth Fibonacci number. Marina MeleMarina Mele has experience in artificial intelligence implementation and has led tech teams for over a decade. On her personal blog (marinamele.com), she writes about personal growth, family values, AI, and other topics she’s passionate about. Marina also publishes…
Python scripts for prime numbers and divisors
Very recently I been interested in solving the problems proposed by Project Euler. Currently I just solved about 20 problems, but I run into some nice algorithms for finding prime numbers and divisors that I would like to share.
This first snippet defines a function that returns a list of the prime numbers up to a given integer. It uses the Sieve of Atkin, which is a modern algorithm that optimizes the Sieve of Eratosthenes.