maths.prime_numbers¶
Attributes¶
Functions¶
Let's benchmark our functions side-by-side... |
|
|
Return a list of all primes numbers up to max. |
|
Return a list of all primes numbers up to max. |
|
Return a list of all primes numbers up to max. |
Module Contents¶
- maths.prime_numbers.benchmark()¶
Let’s benchmark our functions side-by-side…
- maths.prime_numbers.fast_primes(max_n: int) collections.abc.Generator[int] ¶
Return a list of all primes numbers up to max. >>> list(fast_primes(0)) [] >>> list(fast_primes(-1)) [] >>> list(fast_primes(-10)) [] >>> list(fast_primes(25)) [2, 3, 5, 7, 11, 13, 17, 19, 23] >>> list(fast_primes(11)) [2, 3, 5, 7, 11] >>> list(fast_primes(33)) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] >>> list(fast_primes(1000))[-1] 997
- maths.prime_numbers.primes(max_n: int) collections.abc.Generator[int] ¶
Return a list of all primes numbers up to max. >>> list(primes(0)) [] >>> list(primes(-1)) [] >>> list(primes(-10)) [] >>> list(primes(25)) [2, 3, 5, 7, 11, 13, 17, 19, 23] >>> list(primes(11)) [2, 3, 5, 7, 11] >>> list(primes(33)) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] >>> list(primes(1000))[-1] 997
- maths.prime_numbers.slow_primes(max_n: int) collections.abc.Generator[int] ¶
Return a list of all primes numbers up to max. >>> list(slow_primes(0)) [] >>> list(slow_primes(-1)) [] >>> list(slow_primes(-10)) [] >>> list(slow_primes(25)) [2, 3, 5, 7, 11, 13, 17, 19, 23] >>> list(slow_primes(11)) [2, 3, 5, 7, 11] >>> list(slow_primes(33)) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31] >>> list(slow_primes(1000))[-1] 997
- maths.prime_numbers.number¶