galois.prev_prime(n: int) int

Returns the nearest prime \(p\), such that \(p \le n\).

Parameters
n: int

An integer \(n \ge 2\).

Returns

The nearest prime \(p \le n\).

Examples

In [1]: galois.prev_prime(13)
Out[1]: 13

In [2]: galois.prev_prime(15)
Out[2]: 13

In [3]: galois.prev_prime(6298891201241929548477199440981228280038)
Out[3]: 6298891201241929548477199440981228279991