True prime number generator
Mathematical equations are used to locate composite numbers within an interval, enabling the efficient generation of true prime numbers with reduced memory requirements, suitable for cryptography applications.
Patent Information
- Application Number
- PCT/SG2024/050414
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-06-23
- Publication Date
- 2026-01-02
AI Technical Summary
Current prime number generators produce probable primes and require significant memory storage when generating large prime numbers, especially through sieving methods that generate composite numbers by multiplying all factors.
Derivation of mathematical equations to identify the positions of composite numbers within a specified interval, allowing for the efficient generation of true prime numbers without the need to test for primality, thereby reducing memory requirements.
Efficient generation of large prime numbers with reduced memory usage, suitable for key generation in cryptography.
Smart Images

Figure IMGF000003_0001 
Figure IMGF000004_0001 
Figure IMGF000004_0002
Description
[0001] TRUE PRIME NUMBER GENERATOR
[0002] Background of Invention
[0003] Prime numbers are used extensively in cryptography as it is hard to factorize a composite number into it’s prime factors when the prime numbers are large. Large prime numbers are used in key generation. Current prime number generator gives probable primes and then test for primality. Sieving method on the other hand requires huge memory storage when large prime numbers are needed as it generates composite numbers through multiplying all factors of prime numbers. Given an interval to search for large prime numbers, this invention does not require huge memory storage and is able to generate large prime numbers without having to test for primality.
[0004] Summary of Invention
[0005] This invention looks at the application to generate prime numbers through composite numbers as composite numbers can be defined mathematically. Through deriviation of the equations that give the indices of all composite numbers, true prime numbers can be found in between composite numbers. Through this invention, composite numbers need not be found through multiplying all possible factors of prime numbers. Derived equations will find the locations. In specifying an interval to look for prime numbers, memory requirements need not be huge as only all composite numbers within the interval can be found through the equations and prime numbers can be found efficiently especially for large prime numbers. Prime numbers are mostly used in generating keys for encryption.
[0006] Brief Description of Drawings
[0007] Figure 1. Flow diagram of Prime Number Generator. The main blocks for prime number generation are given in this drawing.
[0008] Figure 2. Steps to Generate Composite numbers within the interval (N1,N2) based on the equations. The steps to compute all composite numbers for a certain group of equations. Figure 3. Steps to Generate Prime Numbers. Through finding the gaps between composite numbers, prime numbers are generated.
[0009] Detailed Description of the Invention
[0010] Equations to Generate Odd Composite Numbers
[0011] With the exception of 2, all prime numbers are odd. Let an odd number a be represented: a =1 Ox + c, where c = 1 ,3,7,9 c is not equal to 5 as 5 is the only prime number.
[0012] The equations below denote position of x such that a is an odd composite number. These equations give the position of x for all odd composite numbers according to c. There are 2 groups of equations which generate indices that do not coincide between each group.
[0013] Let p and q starts from 0 onwards and pi and qi starts from 1 onwards,
[0014] Where c = 1 : The positions of indices x generated by Equations (1. 11) to (1. 16) do not coincide with positions of indices generated by Equations (1.21) to (1.26). They generate different locations of composite numbers for these 2 groups of equations. Indices which do not fulfill these equations will give the position of prime numbers ending with 1. Take for example, equation (1.13), for p=0 and q=0, x = 3(5)+ 1 = 16 gives 161 as a composite numbers. Indices which do not fulfill equations (1.11) to (1.16) like 3(4)+l = 13 gives the prime number 131. And 3(3)+l = 10 gives 101 as a prime number, x = 3(indices)+2 will always give composite numbers and hence is not considered.
[0015] Where c = 3 : x = 3{(30q + 13)p1+ q} + l eqn (2.11) x = 3{ [30q + 23 lp + llq + 8 ; + l eqn(2.12) x = 3{(30 q + 7)p + 19 q + 4j + l eqn(2.13) x = 3{(30 q + 17)p + 29q + 16j + l eqn(2.14) x=3{(30q + 13)p + llq + 4}+2 eqn(2.21) x=3{ (30q+23 l p1+q} + 2 eqn(2.22) eqn(2.23) eqn(2.24)
[0016] Where c = 7: x = 3;(30q + 7)p + llq + 2 ! + l eqn(3.11) x=3 ( [30 q + 17,1 px+ q ] + 1 eqn(3.12) Where c= 9:
[0017] Algorithm Flow to Generate Prime Numbers
[0018] All the equations can be represented as 3{(30q+NP)p+NQq+NC}+r where r = 0 or 1 or 2.
[0019] Given the specific odd number to generate (this defines c to be 1 or 3 or 7 or 9), the corresponding parameters given by NP, NQ and NC are defined by the given equations. E g. if c = 1 and r = 1, then NP, NQ and NC are given by equations (1.11) to (1.16). For equation (1.11), NP = 1, NQ =11 and NC = 0. Hence there will be six sets of NP, NQ and NC that will generate all composite numbers within an interval defined by p and q. Looking at the equations giving indices within the curly bracket, ie. indices =(30q+NP)p+NQq+NC, these indices will generate x=3(indices)+r to give the locations for composite numbers
[0020] Given an interval (Nl, N2) for indices within the curly bracket, Figure. 1 shows the concept in the prime number generation. The specific algorithm steps are: Generate Composite numbers within the interval (N1,N2) for a given c and r:
[0021] 1. For an equation in the group of equation, for each q (q starts from 0 or 1 depending on the equation defined by specific c and r), compute the minimum pini„= max([ps, (Nl-NC-NQq) / (30q+NP) ]) where ps= 0 if p is given in the equation and ps= 1 if p, is given in the equation.
[0022] 2. Start from this p = pmin, compute the indices = (30q+NP)p+NQq+NC for each increment of p by 1 until the indices > N2. Increment q by 1 and repeat step 1. If for pmm , the computed indices > N2, stop and go to the next equation in the group and start step 1 with initial q. If there are no more equations to compute, go to step 3.
[0023] 3. Combine all indices from the group of equations and remove duplicates to give the locations of all odd composite numbers according to the equation 3(indices)+r as setl for the interval (N1,N2).
[0024] The steps to generate composite numbers in flow diagram are shown in Figure 2.
[0025] Find the gaps within Composite numbers :
[0026] 1 . Define set2 = N1 :N2 (running numbers from N1 to N2).
[0027] 2. Find the set difference between setl and set2, meaning find elements that are in set2 that are not in setl . These elements give the indices for prime numbers = Indpnme
[0028] Prime numbers:
[0029] 1. Prime numbers are then given as 10(3(Indprime)+r)+c.
[0030] The steps to find the gaps to generate prime numbers are shown in Figure 3.
[0031] The implementation can be optimized for multi-threading, e.g. each thread to generate indices for composite numbers for each equation of the group or each thread is used to generate prime numbers within different intervals. Once the true prime numbers are generated, they can be kept for the generation of keys used in encryption Futher reduction in complexity can be achieved as some of the equations gave common indices, like equations (4.23) and (4.24) which are transpose of each other.
Claims
Claim Listing1 ) The invention breaks down the odd numbers in terms of 1 Ox+c where c = 1 ,3,7,9.2) Equations (1.11) to (1.16) and (1.21) to (1.26) are derived that gives all odd composite numbers for c = 1.3) Equations (2.11) to (2.14) and (2.21) to (2.24) are derived that gives all odd composite numbers for c = 3.4) Equations (3.11) to (3.14) and (3.21) to (3.24) are derived that gives all odd composite numbers for c = 7.5) Equations (4.11) to (4.16) and (4.21) to (4.26) are derived that gives all odd composite numbers for c = 9.6) Given an interval to look for prime numbers, this invention does not require large memory requirements as only composite numbers within the interval will be found through the derived equations. The gaps between the found composite numbers will give true prime numbers.7) Prime numbers will be generated without having to test for primality.