maths.segmented_sieve

Segmented Sieve.

Functions

sieve(→ list[int])

Segmented Sieve.

Module Contents

maths.segmented_sieve.sieve(n: int) list[int]

Segmented Sieve.

Examples: >>> sieve(8) [2, 3, 5, 7]

>>> sieve(27)
[2, 3, 5, 7, 11, 13, 17, 19, 23]
>>> sieve(0)
Traceback (most recent call last):
    ...
ValueError: Number 0 must instead be a positive integer
>>> sieve(-1)
Traceback (most recent call last):
    ...
ValueError: Number -1 must instead be a positive integer
>>> sieve(22.2)
Traceback (most recent call last):
    ...
ValueError: Number 22.2 must instead be a positive integer