First 9 prime Fibonacci number: Difference between revisions

m
Line 1,409:
<syntaxhighlight lang="python">
2 things:
"""for the Fibonacci sequence: an even number is following after 2 odd numbers. Eliminate time to check whether it is prime or not because even numbers are not primes.
for prime numbers: it becomes bigger and bigger. The original algorithm will be slow for super big number. In this case, I use Miller Rabin primality test.
 
P/S: I am not surprised. It is fast but still cannot compare to other languages such as C++ or Rust or .... After all, Python is still slow :P"""
 
def miller_rabin(n, k=5):
4

edits