biogeme.tools.primes module

biogeme.tools.primes.calculate_prime_numbers(upper_bound)[source]

Calculate prime numbers up to a specified upper bound using the Sieve of Eratosthenes.

Parameters:

upper_bound (int) – Prime numbers up to this value will be computed.

Return type:

list[int]

Returns:

A list of prime numbers up to the upper bound.

Raises:

BiogemeError – If the sqrt_max is incorrectly defined (e.g., negative number).

biogeme.tools.primes.get_prime_numbers(n)[source]

Get a given number of prime numbers.

Parameters:

n (int) – Number of primes that are requested.

Return type:

list[int]

Returns:

List with prime numbers.

Raises:

BiogemeError – If the requested number is non-positive.