Back to Research

    The Index Identity and Primality by Exclusion in the Generalized Index Generator (GIG) Sequence

    Lord Sofiane AouadeneIndependent Researcher and Curious MindDecember 2025Preprint — Not Peer-Reviewed

    Abstract

    This paper presents a formal derivation of the multiplicative closure property within the Generalized Index Generator (GIG) sequence, X(k)X(k). We establish a novel Index Identity that translates the product of two GIG terms, X(n)X(m)X(n) \cdot X(m), directly into the index KK of the resulting composite term, where K=n+m6nmK = n + m - 6nm. This identity shifts the problem of primality testing from arithmetic calculation to index exclusion: if an index KK cannot be generated by this polynomial, the resulting term X(K)X(K) is prime. We formally establish the necessary and sufficient conditions for this criterion, analyze the computational complexity, explicitly address the O(Kmax)O(|K|_{max}) space bottleneck, and introduce the Segmented GIG Index Sieve as the solution for practical memory utilization.

    1. The Unified GIG Sequence Definition and Structure

    The Generalized Index Generator (GIG) sequence X(k)X(k) is a deterministic sequence of integers, indexed by kZ{0}k \in \mathbb{Z} \setminus \{0\}, which contains all integers greater than 3 that are not divisible by 2 or 3. This set includes all prime numbers greater than 3.

    1.1. GIG Term Definition and Scope

    The sequence is defined by the unified absolute value function, which captures all numbers congruent to ±1(mod6)\pm 1 \pmod{6}:

    X(k)=6k1X(k) = |6k - 1|

    The GIG sequence contains both primes PGIGP_{GIG} and an infinite number of composite numbers CGIGC_{GIG} (e.g., 25, 35, 49, etc.). The core challenge addressed is the efficient differentiation between the prime and composite terms based solely on their index KK.

    1.2. Indexing and Sequence Generation

    The sign of the index kk determines the form of the resulting term X(k)X(k) and its congruence modulo 6:

    X(k)={6k1if k>0(i.e., X(k)5(mod6))6k+1if k<0(i.e., X(k)1(mod6))X(k) = \begin{cases} 6k - 1 & \text{if } k > 0 \quad (\text{i.e., } X(k) \equiv 5 \pmod{6}) \\ 6|k| + 1 & \text{if } k < 0 \quad (\text{i.e., } X(k) \equiv 1 \pmod{6}) \end{cases}

    1.3. Ordinal Position and Index Mapping

    The GIG sequence terms are ordered ascendingly by magnitude: 5,7,11,13,17,19,5, 7, 11, 13, 17, 19, \ldots. The relationship between the ordinal position i=1,2,3,i = 1, 2, 3, \ldots and the GIG index kk is given below.

    Ordinal Position iiTerm Value X(k)X(k)GIG Index kkCongruence
    15k=1k=15(mod6)5 \pmod{6}
    27k=1k=-11(mod6)1 \pmod{6}
    311k=2k=25(mod6)5 \pmod{6}
    413k=2k=-21(mod6)1 \pmod{6}
    517k=3k=35(mod6)5 \pmod{6}
    619k=3k=-31(mod6)1 \pmod{6}

    2. Formal Derivation of the Index Identity

    The GIG sequence is closed under multiplication: the product of any two GIG terms X(n)X(m)X(n) \cdot X(m) yields another GIG term X(K)X(K).

    2.1. Algebraic Expansion of the Product

    Let nn and mm be non-zero integers representing the indices of the factors. The product P=X(n)X(m)P = X(n) \cdot X(m) always has the general algebraic expansion:

    P=6n16m1=36nm6n6m+1=36nm6(n+m)+1(Since P25, the expression is positive)\begin{aligned} P &= |6n - 1| \cdot |6m - 1| \\ &= |36nm - 6n - 6m + 1| \\ &= 36nm - 6(n+m) + 1 \quad (\text{Since } P \ge 25, \text{ the expression is positive}) \end{aligned}

    2.2. The Index Identity: Unified Proof

    Theorem 2.1 (The Index Identity)

    For any two non-zero GIG indices nn and mm, the index KK of their product X(K)=X(n)X(m)X(K) = X(n) \cdot X(m) is given universally by the polynomial:

    K=n+m6nm\mathbf{K = n + m - 6nm}

    Proof: We solve for the index KK such that X(K)=6K1=PX(K) = |6K - 1| = P. The derivation is split into cases based on the congruence of the product PP modulo 6.

    Case A: P1(mod6)P \equiv 1 \pmod{6} (Indices n,mn, m have the same sign)

    When nn and mm have the same sign (e.g., (+,+)(+, +) or (,)(-, -)), the product PP is congruent to 1(mod6)1 \pmod{6}. The resulting term X(K)X(K) must satisfy X(K)=6K+1=6(K)+1X(K) = 6|K| + 1 = 6(-K) + 1 (since KK must be negative). Substituting the general expansion for PP:

    6(K)+1=36nm6(n+m)+1K=6nm(n+m)K=n+m6nm\begin{aligned} 6(-K) + 1 &= 36nm - 6(n+m) + 1 \\ -K &= 6nm - (n+m) \\ \mathbf{K} &= \mathbf{n + m - 6nm} \end{aligned}

    Case B: P5(mod6)P \equiv 5 \pmod{6} (Indices n,mn, m have opposite signs)

    When nn and mm have opposite signs, the product PP is congruent to 5(mod6)5 \pmod{6}. The resulting term X(K)X(K) must satisfy X(K)=6K1X(K) = 6K - 1 (since KK must be positive). Without loss of generality, let n>0n>0 and m<0m<0, so we write m=mm = -|m|. The product PP is explicitly:

    P=(6n1)(6m+1)=36nm+6n6m1P = (6n - 1)(6|m| + 1) = 36n|m| + 6n - 6|m| - 1

    We solve for KK by equating P=6K1P = 6K - 1:

    6K1=36nm+6n6m16K=6(6nm+nm)K=6nm+nm\begin{aligned} 6K - 1 &= 36n|m| + 6n - 6|m| - 1 \\ 6K &= 6(6n|m| + n - |m|) \\ K &= 6n|m| + n - |m| \end{aligned}

    Substituting the signed index m=mm = -|m| into the proposed identity K=n+m6nm\mathbf{K = n + m - 6nm} gives n+(m)6n(m)=nm+6nmn + (-|m|) - 6n(-|m|) = n - |m| + 6n|m|. Since the results match, the Index Identity is proven universally. \square

    2.3. Completeness of the Index Mapping

    The function K(n,m)K(n, m) is sufficient to generate the full set of composite indices CZC_{\mathbb{Z}}. The table below confirms that the sign permutations of the factors (n,m)(n, m) correctly determine the sign and magnitude of KK.

    n,mn, m SignTerm ProductResulting Index KKExample
    (+,+)(+, +)551(mod6)5 \cdot 5 \equiv 1 \pmod{6}K<0K < 0(2,3)K=31(2, 3) \Rightarrow K = -31
    (,)(-, -)111(mod6)1 \cdot 1 \equiv 1 \pmod{6}K<0K < 0(2,3)K=41(-2, -3) \Rightarrow K = -41
    (+,)(+, -)515(mod6)5 \cdot 1 \equiv 5 \pmod{6}K>0K > 0(2,3)K=35(2, -3) \Rightarrow K = 35
    (,+)(-, +)155(mod6)1 \cdot 5 \equiv 5 \pmod{6}K>0K > 0(2,3)K=37(-2, 3) \Rightarrow K = 37

    3. Primality Testing via Index Exclusion

    3.1. GIG Factor Closure Lemma

    Lemma 3.1 (GIG Factor Closure): Every composite number C>3C > 3 that is contained in the GIG sequence (CCGIGC \in C_{GIG}) must be factorable into two terms, P1P_1 and P2P_2, where both P1P_1 and P2P_2 are also members of the GIG sequence.

    Justification: A composite number CCGIGC \in C_{GIG} satisfies C±1(mod6)C \equiv \pm 1 \pmod{6}. The congruence C(mod6)(P1(mod6))(P2(mod6))±1(mod6)C \pmod{6} \equiv (P_1 \pmod{6}) \cdot (P_2 \pmod{6}) \equiv \pm 1 \pmod{6} necessitates that both factors P1P_1 and P2P_2 must also be congruent to ±1(mod6)\pm 1 \pmod{6} (i.e., P1,P2GIGP_1, P_2 \in GIG).

    3.2. GIG Primality Criterion

    Theorem 3.2 (GIG Primality Criterion): A GIG term X(K)X(K) is prime if and only if there do not exist non-zero integers n,mn,m such that the index KK is generated by the Index Identity: K=n+m6nm\mathbf{K = n+m-6nm}.

    Proof: This is a direct consequence of Theorem 2.1 (The Index Identity) and Lemma 3.1 (GIG Factor Closure). If X(K)X(K) is composite, it must factor into X(n)X(m)X(n) \cdot X(m), guaranteeing KK is constructible. If KK is constructible, X(K)X(K) is a product of two non-trivial factors, making it composite. \square

    4. Composite Sequence Generation Algorithm and Complexity

    4.1. Boundary Retrieval and Redundancy Reduction

    The systematic search for composite indices KK requires defining a factor limit NN, relative to the maximum absolute index magnitude under consideration, Kmax|K|_{max}:

    N6Kmax36=Kmax6N \approx \sqrt{\frac{6|K|_{max}}{36}} = \sqrt{\frac{|K|_{max}}{6}}

    Redundancy Reduction: The search space is halved by imposing the ordering constraint nm|n| \ge |m|, exploiting the symmetry of the Index Identity, K(n,m)=K(m,n)K(n,m) = K(m,n).

    4.2. Computational Complexity and Practical Bottlenecks

    Time Complexity: Since the factor search is proportional to N2N^2, where NKmaxN \sim \sqrt{|K|_{max}}, the time complexity of generating the composite index set up to Kmax|K|_{max} is linear:

    T(Kmax)=O(Kmax)\mathbf{T(|K|_{max}) = O(|K|_{max})}

    Space Complexity Bottleneck: The requirement to store all composite indices up to Kmax|K|_{max} for exclusion results in an unmanageable space complexity for large limits: S(Kmax)=O(Kmax)\mathbf{S(|K|_{max}) = O(|K|_{max})}.

    4.3. The Segmented GIG Index Sieve

    To address the space complexity bottleneck, the Segmented GIG Index Sieve is employed. This technique constrains the primality test to a segment [Kstart,Kend][K_{start}, K_{end}] of indices at a time.

    • Segmentation: The full range is divided into segments of size SS.
    • Factor Bound NN: The factor loop utilizes the full NN bound (based on the highest limit of the overall range) to ensure all necessary factors for marking composites within the current segment are included.
    • Memory Utilization: A temporary Boolean array of size SS is used to mark composite indices KK that fall within the current segment. The memory consumption is effectively reduced to O(S)\mathbf{O(S)}, independent of the overall limit Kmax|K|_{max}.

    5. Pseudocode Implementation

    5.1. Core Identity Functions

    These functions define the mapping between the index and the GIG term, and the Index Identity used to generate composite indices.

    FUNCTION GIG_TERM(k: Integer) -> Integer
        // Calculates the GIG sequence term X(k) = |6k - 1|
        RETURN ABS(6 * k - 1)
    END FUNCTION
    
    FUNCTION COMPOSITE_INDEX_K(n: Integer, m: Integer) -> Integer
        // Index Identity: K = n + m - 6nm
        // 'n' and 'm' are the indices of the two GIG factors.
        RETURN n + m - 6 * n * m
    END FUNCTION

    5.2. Segmented GIG Index Sieve Logic

    This procedure implements the Index Identity for efficient generation of composite indices within a fixed range, embodying the Segmented Sieve strategy.

    FUNCTION GENERATE_COMPOSITE_INDICES_IN_RANGE(K_start: Integer, K_end: Integer) -> Set<Integer>
        // Determines the optimal search depth N based on the range limit
        K_max_abs = MAX(ABS(K_start), ABS(K_end))
        N = FLOOR(SQRT(K_max_abs / 6)) + 5 // Factor limit for the largest possible factor index
        
        UNIQUE_K = New Set()
        
        // Iterate factors i and j up to the maximum required bound N
        FOR i FROM 1 TO N DO
            // Redundancy Reduction: Enforce |n| >= |m| by checking j <= i
            FOR j FROM 1 TO i DO
                
                // Test all four sign permutations to cover all GIG product types
                PERMUTATIONS = [(i, j), (-i, -j), (i, -j), (-i, j)]
                
                FOR EACH (n, m) IN PERMUTATIONS DO
                    // Calculate the composite index K using the Index Identity
                    K = COMPOSITE_INDEX_K(n, m)
                    
                    // Check if the calculated index K falls within the current segment
                    IF K_start <= K AND K <= K_end THEN
                        UNIQUE_K.ADD(K)
                    END IF
                END FOR
                
            END FOR
        END FOR
        
        // The resulting set contains all indices K whose corresponding term X(K) is composite.
        RETURN UNIQUE_K.SORTED()
    END FUNCTION

    6. Implications for Number Theory and Algorithm Design

    The Index Identity and the resulting exclusion method offer significant theoretical and practical advancements.

    6.1. Theoretical Significance

    The identity K=n+m6nm\mathbf{K = n + m - 6nm} provides a closed-form, polynomial definition of the structure of all composite numbers greater than 3. This fundamentally changes the framework for primality analysis, shifting the focus from the chaotic distribution of prime numbers to the ordered, deterministic generation of composite numbers via a simple quadratic function of two integer variables. This structured approach provides a new algebraic tool for addressing problems related to prime distribution.

    6.2. Algorithmic Significance

    Time Complexity: The O(Kmax)\mathbf{O(|K|_{max})} time complexity, combined with the redundancy reduction optimization, establishes this as an exceptionally fast deterministic sieve method, relying primarily on high-speed integer arithmetic.

    Space Efficiency: The Segmented GIG Index Sieve (Section 4.3) successfully removes the O(Kmax)\mathbf{O(|K|_{max})} space constraint, transforming the method from a theoretical construct into a practical, memory-efficient algorithm for large-scale primality testing and sequence generation.

    References

    1. Aouadene, S. (2025). The Generalized Index Generator (GIG). Zenodo. https://doi.org/10.5281/zenodo.17847579
    2. Ribenboim, P. (2004). The Little Book of Bigger Primes (2nd ed.). Springer-Verlag.

    Compiled December 2025