1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! Prime Table — Build-Time Generated Reference Database
//!
//! Contains all primes up to 10,000 generated via Sieve of Eratosthenes
//! at compile time by `build.rs`. Zero external dependencies.
//!
//! # Usage
//!
//! ```rust
//! use g_math::fixed_point::tables::prime_table::{PRIME_TABLE, PRIME_COUNT, MAX_PRIME};
//!
//! // Check if 97 is prime
//! assert!(PRIME_TABLE.binary_search(&97).is_ok());
//!
//! // Iterate first 10 primes
//! for &p in &PRIME_TABLE[..10] {
//! println!("{}", p);
//! }
//! ```
include!;
include!;
/// Check if a number exists in the precomputed prime table.
///
/// Uses binary search — O(log n) where n = PRIME_COUNT (1,145 primes).
/// Only valid for values up to MAX_PRIME (9,973).
/// Return the nth prime (0-indexed). Returns None if index >= PRIME_COUNT.
/// Count of primes up to and including `limit`.
/// Returns 0 if limit < 2.