MaxN
untyped bigintMaxN bounds the sieve so gas stays predictable.
Value
(10000 <untyped> bigint)
PrimesUpTo
func(n int) []intPrimesUpTo returns every prime p with 2 \<= p \<= n, in ascending order, using the Sieve of Eratosthenes. n is clamped to \[0, MaxN]. Pure.
- OID
- 0cd977…39d0:3
PrimesUpTo details
NthPrime
func(k int) intNthPrime returns the k-th prime (1-indexed), or 0 if it lies beyond MaxN. Pure helper handy for callers and tests.
- OID
- 0cd977…39d0:5
NthPrime details
IsPrime
func(x int) boolIsPrime reports whether x is prime (trial division). Pure.
- OID
- 0cd977…39d0:6
IsPrime details
Render
func(path string) stringRender renders the sieve for gnoweb. Render("") / Render("/") -> first 100 primes + total count up to MaxN Render("/<n>") -> every prime <= n, laid out as a grid
- OID
- 0cd977…39d0:7
Render details
parseN
func(path string) (int, bool)parseN extracts n from a Render path like "/1000". Returns hasN=false for the empty/root path.
- OID
- 0cd977…39d0:8
parseN details
grid
func(primes []int, cols int) stringgrid formats primes into a Markdown table with \`cols\` columns per row.
- OID
- 0cd977…39d0:9