const MaxN
MaxN bounds the sieve so gas stays predictable.
Package sieve is an on-chain port of Go's classic concurrent prime sieve (the "prime sieve" example from the Go tour ...
Package sieve is an on-chain port of Go's classic concurrent prime sieve (the "prime sieve" example from the Go tour / Go source docs), implemented as a deterministic, allocation-friendly Sieve of Eratosthenes so it runs reproducibly on-chain (no goroutines, channels, or clocks).
IsPrime reports whether x is prime (trial division). Pure.
NthPrime returns the k-th prime (1-indexed), or 0 if it lies beyond MaxN. Pure helper handy for callers and tests.
PrimesUpTo returns every prime p with 2 <= p <= n, in ascending order, using the Sieve of Eratosthenes. n is clamped to [0, MaxN]. Pure.