galois.next_prime

galois.next_prime(n: int) int

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

Parameters
n: int

An integer.

Returns

The nearest prime \(p > n\).

Examples

In [1]: galois.next_prime(13)
Out[1]: 17

In [2]: galois.next_prime(15)
Out[2]: 17

In [3]: galois.next_prime(6852976918500265458318414454675831645298)
Out[3]: 6852976918500265458318414454675831645343

Last update: Apr 21, 2022