T-sequence apparatus and method for general deterministic polynomial-time primality testing and composite factoring
09542158 ยท 2017-01-10
Inventors
Cpc classification
G06F7/586
PHYSICS
H04L9/3033
ELECTRICITY
International classification
H04L9/30
ELECTRICITY
H04L9/06
ELECTRICITY
Abstract
A new mathematical technique called the T-sequence is a primality testing method. A similar approach can be applied to perform fast factoring for numerous special cases, a method that can, in all likelihood, be extended to the general case, making possible a general and fast factoring algorithm. The same T-sequence can be used to construct a prime number formula and a good random number generator.
Claims
1. A computer-implemented method for generating prime numbers for data encryption via a computer system, wherein the computer system comprises one or more processors, a random-access memory, a read-only (non-volatile) memory, and an I/O subsystem, the method comprising: determining at least one element of a T-sequence, the T-sequence being one of a family of related non-montonic sequences and being defined as: T.sup.l.sub.0=2, T.sup.l.sub.1=l and T.sup.l.sub.n+1=l.Math.T.sup.l.sub.nT.sup.l.sub.n1, wherein the subscript denotes the nth term while the superscript denotes the order l, such that the zeroth term is 2 and the first term is l, and wherein l=3 is the first T-sequence, and each successive term is defined as follows: T.sup.3.sub.02, T.sup.3.sub.1=3, T.sup.3.sub.2=7, T.sup.3.sub.3=18, . . . , T.sup.3.sub.n+1=3.Math.T.sup.3.sub.nT.sup.3.sub.n1; using said at least one element to determine primality of at least one arbitrary positive integer by performing a binary decomposition on the at least one arbitrary positive integer in polynomial time; wherein within the random-access memory and the read-only memory a routine is stored for generating T-sequence terms, and wherein the routine is used by one or more other routines, the one or more routines including a primality testing routine, a factoring routine, a prime number generator, and/or a random number generator; and encrypting data using a cryptographic function for data security within a computer system or network utilizing the primality of at least one arbitrary positive integer determined by the binary decomposition.
2. The method of claim 1, where l=4 is the second T-sequence and each successive term is defined as follows:
T.sup.4.sub.0=2, T.sup.4.sub.1=4, T.sup.4.sub.2=14, T.sup.4.sub.3=52, . . . , T.sup.4.sub.n+1=4.Math.T.sup.4.sub.nT.sup.4.sub.n1, etc.
3. The method of claim 1, wherein all T-terms are expressed by:
T.sup.l.sub.n1+n2=T.sup.l.sub.n1.Math.T.sup.l.sub.n1n2 where n.sub.1n.sub.2 and n=n.sub.1+n.sub.2.
4. The method of claim 3, wherein:
T.sup.l.sub.2n+1=T.sup.l.sub.n1.Math.T.sup.l.sub.n+1T.sup.l.sub.n.Math.T.sup.l.sub.n+1l, for odd nth terms; and
T.sup.l.sub.2n=T.sup.l.sub.n.Math.T.sup.l.sub.nT.sup.l.sub.0=(T.sup.l.sub.n).sup.22, for even nth terms.
5. The method of claim 1, comprising: identifying the primality of the at least one positive integer in polynomial time by obtaining definitive characteristics of the positive integer's quadratic residue.
6. A non-transitory computer readable storage medium containing instructions for a computer-implemented method of generating a prime number for data encryption via a computer system, wherein the computer system comprises one or more processors, a random-access memory, a read-only (non-volatile) memory, and an I/O subsystem, the computer-implemented method of generating the prime number for data encryption comprising: generating candidate numbers by forming at least one of sums and differences of a given number and a series of prime numbers; deterministically evaluating primality of each of the candidate numbers in polynomial time, wherein said means for deterministically evaluating primality comprises means for determining at least one element of a non-montonic sequence, the non-montonic sequence being one of a family of related non-montonic sequences, and wherein said family of related non-montonic sequences is defined as follows: T.sup.l.sub.0=2, T.sup.l.sub.1=l and T.sup.l.sub.n+1=l.Math.T.sup.l.sub.nT.sup.l.sub.n1, wherein the subscript denotes the nth term while the superscript denotes the order l; identifying the primality of the candidate numbers in polynomial time by performing a binary decomposition on the candidate numbers; wherein within the random-access memory and the read-only memory a routine is stored for generating T-sequence terms, and wherein the routine is used by one or more other routines, the one or more routines including a primality testing routine, a factoring routine, a prime number generator, and/or a random number generator; and encrypting data using a cryptographic function for data security within a computer system or network utilizing one or more of the candidate numbers identified in polynomial time as prime numbers.
7. The non-transitory computer readable storage medium of claim 6, wherein l=3 is the first T-sequence, and each successive term is defined as follows:
T.sup.3.sub.02, T.sup.3.sub.1=3, T.sup.3.sub.2=7, T.sup.3.sub.3=18, . . . , T.sup.3.sub.n+1=3.Math.T.sup.3.sub.nT.sup.3.sub.n1.
8. The non-transitory computer readable storage medium of claim 6, comprising: identifying the primality of the number in polynomial time by obtaining definitive characteristics of the number's quadratic residue.
9. A non-transitory computer readable storage medium containing instructions for a computer-implemented method of generating a prime number for a data encryption system in polynomial time via a computer system, wherein the computer system comprises one or more processors, a random-access memory, a read-only (non-volatile) memory, and an I/O subsystem, the computer-implemented method of generating the prime number for the data encryption system in polynomial time comprising: performing a first step, which comprises: determining at least one element of a T-sequence, the T-sequence being defined as: T.sup.l.sub.0=2, T.sup.l.sub.1=l and T.sup.l.sub.n+1=l.Math.T.sup.l.sub.nT.sup.l.sub.n1 wherein the subscript denotes the nth term while the superscript denotes the order l; and performing a first step, wherein the first step comprises for any given positive integer n, wherein l=3, wherein determining the l type of n in T.sup.3, and wherein any n with a last digit 1 or 9 will be of a l type, and any n with a last digit of 3 or 7 will be of a +l type; and computing at least two residues R.sup.3.sub.n1=T.sup.3.sub.n1 (mod n) and R.sup.3.sub.n=T.sup.3.sub.n (mod n), wherein, if either R.sup.3.sub.n12 or 7 (=l.sup.22) and/or R.sup.3.sub.n3, then n can be declared to be a composite, and wherein all composites which are not genuine primes or pseudoprimes or proper cofactors of T.sup.3 will be detected and sieved away; if R.sup.3.sub.n1=2 or 7 (=l.sup.22) (mod n) and R.sup.3.sub.n=3 (mod n) then performing a second step comprised of a greatest common factor sieving to sieve away certain pseudoprimes, and wherein the greatest common factor sieving further comprises: using an Euclidean algorithm to obtain a greatest common factor; and computing the greatest common factor, wherein for n to be a candidate for prime, the odd term residue R.sub.d.sup.3 right under R.sub.n.sup.3 when 2 is subtracted must at least be coprime to n, and wherein the greatest common denominator of R.sub.d.sup.l2 and n is equal to 1; performing a third step, wherein the third step is performed if the second step of performing the greatest common factor sieving misses some pseudoprimes or cofactor composites, and wherein all possible exceptions in the form of proper cofactors or pseudoprimes will be sieved away, leaving only the genuine primes; wherein within the random-access memory and the read-only memory a routine is stored for generating T-sequence terms, and wherein the routine is used by one or more other routines, the one or more routines including a primality testing routine, a factoring routine, a prime number generator, and/or a random number generator; and encrypting data using a cryptographic function for data security within a computer system or network utilizing one or more of the genuine primes left in the third step.
10. The non-transitory computer readable storage medium of claim 9, wherein the third step of sieving further comprises finding an l which is of opposite l type to that in the first step of T.sup.3.
11. The non-transitory computer readable storage medium of claim 10, wherein if in the first step the l type of n in T.sup.3 is negative, then in the third step, finding an l for which the l type of n is positive in T l and vice versa.
12. The non-transitory computer readable storage medium of claim 11, wherein the third step comprises computations of small residue r or direct computations of T.sup.l.sub.n12 or l.sup.22 (mod n) and T.sup.l.sub.nl (mod n).
13. The non-transitory computer readable storage medium of claim 12, wherein if in the first step T.sup.3.sub.n12 (mod n) and T.sup.3.sub.n3 (mod n) is of the l type, then for another l in which the l type of n in T.sup.l is opposite to that in T.sup.3 and wherein T.sup.l.sub.n1l.sup.22 (mod n) and T.sup.l.sub.nl (mod n), such that the +l type, n will be a genuine prime.
14. The non-transitory computer readable storage medium of claim 13, comprising: using a Jacobi method to avoid blind trials seeking for opposite l types.
15. The non-transitory computer readable storage medium of claim 14, comprising: wherein the Jacobi method is defined as l.sup.2-4, n; and calculating the l types beginning with l=3 until the lowest values of l having opposite types have been found.
16. The non-transitory computer readable storage medium of claim 9, comprising: identifying the primality of the number in polynomial time by obtaining definitive characteristics of the number's quadratic residue.
Description
BRIEF DESCRIPTION OF THE DRAWING
(1) The present invention may be further understood from the following description in conjunction with the appended drawing. In the drawing:
(2)
(3)
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
(4) T-Sequences: Definition.
(5) Let n be a positive integer and l3 be the order. Then the general T-sequences are defined as follows:
T.sub.0.sup.l=2, T.sub.1.sup.l=l and T.sub.n+1.sup.l=l.Math.T.sub.n.sup.lT.sub.n1.sup.l,
where the subscript denotes the nth term while the superscript denotes the order l. Therefore the zeroth term is always 2 and the first term is always l; i.e., l=3 is the first T-sequence, the successive terms of which are given by
T.sub.0.sup.3=2, T.sub.1.sup.3=3, T.sub.2.sup.3=7, T.sub.3.sup.3=18, . . . , T.sub.n+1.sup.3=3.Math.T.sub.n.sup.3T.sub.n1.sup.3.
T.sub.n.sup.4 is the second T-sequence with the following terms:
T.sub.0.sup.4=2, T.sub.1.sup.4=4, T.sub.2.sup.4=14, T.sub.3.sup.4=52, . . . , T.sub.n+1.sup.4=4.Math.T.sub.n.sup.4T.sub.n1.sup.4, etc.
(6) There is a general and fundamental identify relating all T terms, as expressed by:
T.sub.n.sub.
From this can be derived the following convenient identities:
T.sub.2n+1.sup.l=T.sub.n.sup.l.Math.T.sub.n+1.sup.lT.sub.1.sup.l=T.sub.n.sup.l.Math.T.sub.n+1.sup.ll (odd nth terms)(1)
T.sub.2n.sup.l=T.sub.n.sup.l.Math.T.sup.l.sub.nT.sub.0.sup.l=(T.sub.n.sup.l).sup.22 (even nth terms)(2)
(7) The T terms can grow exponentially large, but with the above identities as well as modulo arithmetic and a type of binary decomposition method described below, testing a given integer for primality is straightforward.
(8) A numerical example serves to illustrate this approach. E.g., for n=31 and l=3, binary decomposition is first performed (other forms of decomposition are feasible but are less practical):
T.sub.31.sup.3=T.sub.16.sup.3.Math.T.sub.15.sup.33
T.sub.16.sup.3=(T.sub.8.sup.3).sup.22
T.sub.15.sup.3=T.sub.8.sup.3.Math.T.sub.7.sup.33
T.sub.8.sup.3=(T.sub.4.sup.3).sup.22
T.sub.7.sup.3=T.sub.4.sup.3.Math.T.sub.3.sup.33
T.sub.4.sup.3=(T.sub.2.sup.3).sup.22
T.sub.3.sup.3=T.sub.2.sup.3.Math.T.sub.1.sup.33
T.sub.2.sup.3=(T.sub.1.sup.3).sup.22
(9) For decomposition of odd terms D the quantity
(10)
is computed. If the result is an odd number as in
(11)
1 is added to 15 to give 16 so that 31=16+15. If the result is an even number such as
(12)
again 1 is added to 18 to give 19 so that 37=18+19. The successive terms can then be computed by using the above-mentioned identities. For odd nth terms such as T.sub.31.sup.3, the quantity T.sub.1.sup.l, or l, is always subtracted, which is 3 in this example. For even nth terms such as T.sub.16.sup.3, the quantity T.sub.0.sup.l, or 2, is always subtracted. The fundamental identify allows all these decompositions to be performed. Modulo arithmetic with respect to n and recursive substitutions are then carried out using the fact that, always, T.sub.0.sup.l=2 and T.sub.1.sup.l=l; that is, T.sub.0.sup.3=2, T.sub.1.sup.3=3 in this example.
(13) Computations are then started from the smallest term, that is T.sub.2.sup.3=(T.sub.1.sup.3).sup.22=3.sup.22=7, T.sub.3.sup.3=T.sub.2.sup.3.Math.T.sub.1.sup.33=7.Math.33=18, and so on, with the residues always modulo 31:
(14) ##STR00001##
(15) Therefore it can be determined that in this example the 31st term of T.sup.3 (mod 31) gives a residue of 3. Of course the residue of any term of T.sup.l (mod n) can be readily computed whenever needed.
(16) There are numerous intriguing properties of T-sequences, one of which is expressed as
(17)
or equivalently
(18)
(19) From this expression one can prove that all primes p will have to satisfy the relations T.sub.p.sup.l=l (mod p) and T.sub.p1.sup.l=2 or l.sup.2=2 (mod p), as in the numerical example above for the prime p=31:
T.sub.31.sup.3=3 (mod 31) and T.sub.30.sup.3=2 (mod 30).
(20) By using these T-sequences in connection with the primes p, another important and useful property in primality testing and factoring can be derived, the so-called periods k(p) consisting of two types, p+1 and p1. The former is called the +l type and the latter the l type. What is meant by this terminology can be illustrated by the following numerical examples:
(21) Take l=3 and p=7. Compute every term of T.sup.3 successively modulo 7; that is, every T.sup.3 term is divided by 7 to give the respective residues, until the residues repeat themselves. Thus using R as the residue and l always equal to 3, one obtains for the modulo of prime p=7: R.sub.0=2, R.sub.1=3, R.sub.2=0, R.sub.3=4, R.sub.4=5, R.sub.5=4, R.sub.6=0, R.sub.7=3, R.sub.8=2, . . . . The next residue with 2 appears at the eighth term R.sub.8=2, thus the period k(7)=8. Note that this period divides exactly into p+1, that is, k(p)|p+1k(7)=8. Thus the prime 7 is said to be of the +l type in T.sup.3 sequence.
(22) Again take l=4 and p=11. The residues of each T.sup.4 term, modulo 11, are: R.sub.0=2, R.sub.2=3, R.sub.2=3, R.sub.3=8, R.sub.4=7, R.sub.5=9, R.sub.6=7, R.sub.7=8, R.sub.8=3, R.sub.9=4, R.sub.10=2, . . . . The next residue of 2 appears at the 10th term R.sub.10=2, hence the period k(11)=10. This period of 10 divides exactly into p1, that is, k(p)|(p1)10|111. Thus the prime 11 is said to be of l type in T.sup.4 sequence.
(23) There are no other possible patterns for prime modulo. (The l type for composites will be shown in the following section describing the primality testing algorithm.) In essence, this unique characteristic of the T-sequences enables the primality of any positive integer to be determined, since only those numbers that are genuine primes can satisfy for appropriate l values both
T.sub.p1.sup.+ll.sup.22, T.sub.p.sup.+ll and T.sub.p1.sup.l2, T.sub.p.sup.ll (mod p),
Furthermore, this characteristic can also be used to do general polynomial time factoring of composites.
Computing Using T-Sequences
(24) Referring now to
(25) Primality Testing
(26) Given any positive integer n, the T.sup.3 sequence may be used to perform primality testing (any other T.sup.l sequence will do but T.sup.3 is convenient for use here). Using binary decomposition and the above-mentioned methods, the residues are computed
R.sub.n1.sup.3T.sub.n1.sup.3 (mod n) and R.sub.n.sup.3=T.sub.n.sup.3 (mod n).
(27) For n to be an eligible candidate for prime, the residues have to be
R.sub.n1.sup.3=2 or l.sup.22 and R.sub.n.sup.3=3.
Any n which does not give such residues can immediately be declared composite.
(28) As will be explained below, it can be seen readily that any n with the last digit 1 or 9 will be of the l type in T.sup.3, whereas any n with the last digit 3 or 7 will be of the +l type in T.sup.3.
(29) A fast and general method to determine the l type of n in T.sup.l (to be used in proving and determining the genuine primality of n) is as follows. Given the values of any n and l, divide n by the determinant 2l.sup.28 and obtain the small residue r, that is nr (mod 2l.sup.28). It can be shown that the l type of n is the same as that of r. Since r is so small, direct computation of its residues in T.sup.l will readily give the l type, knowing that by definition the l type is + when
R.sub.r1.sup.l=l.sup.21 and R.sub.r.sup.l=l (both mod r), and is when
R.sub.r1.sup.l=2 and R.sub.r.sup.l=l (both mod r).
(30) Note a few facts about the relationships between r and l: 1. The l type is always whenever r=l. 2. The small residue r must be coprime to the determinant, that is (r, 2l.sup.28)=1. This means that whenever r is not coprime to 2l.sup.28, that particular l value is not used. 3. Besides r being coprime to the determinant, r needs to be greater than the value of l. Otherwise that particular l value is not used. 4. The period k(r) must be greater than 2. When the period is 1 or 2, that l value is not to be used. 5. Applying the above identities and binary decomposition methods to r will give R.sub.r1.sup.l and R.sub.r.sup.l. Whenever R.sub.r1.sup.l2 or l.sup.22 and/or R.sub.r.sup.ll, that particular l value will not be used. When R.sub.r1.sup.l=2 or l.sup.22 and R.sub.r.sup.l=l, that particular l value will be used. 6. The +l type and the l type occur in equal proportion among all n and T.sup.l. It can be shown that one l with +l type and another l with l type can readily be found for any n.
(31) For example, when n=31, l=3 observe that r=1 since 31=1 (mod 2.Math.3.sup.28=10). It is then known from the facts above that 31 is of l type in T.sup.3. On the other hand, when n=37, l=3 observe that r=7 since 37=7 (mod 2.Math.3.sup.28=10). The quantities R.sub.71.sup.3=7 and R.sub.7.sup.3=3 (both mod 7) are then computed, from which it appears that 7 is of +l type in T.sup.3. Hence 37 is also of +l type in T.sup.3.
(32) To take another example, when n=31, l=4 observe that r=7 since 31=7 (mod 2.Math.4.sup.28=24). Direct computations like those mentioned above give R.sub.71.sup.4=7 and R.sub.7.sup.47=4 (both mod 7). This shows that 7 is of +l type in T.sup.4 and thus 31 must also be of +l type in T.sup.4: On the other hand, when n=37, l=4 observe that r=13 since 37=13 (mod). Similar direct computations give R.sub.131.sup.4=2 and R.sub.13.sup.4=4 (both mod 13). This shows that 13 is of l type in T.sup.4 and thus 37 must also be of l type in T.sup.4. It is seen then that 31 and 37 are of opposite l type in T.sup.3 and T.sup.4.
(33) Note that these small r residue computations can be skipped and the n residues computed directly for primality testing and l-type decisions whenever r is indeterminate. The whole-algorithm will still be in polynomial time owing to binary decomposition, which ensures that it is in polynomial time. The complexity is of the order of (log.sub.2n).sup.3.
(34) Referring now to
(35) STEP A: For any given positive integer n, first use l=3. From the above, determine the l type of n in T.sup.3, l type for last digit 1 or 9, +l type for last digit 3 or 7. Then compute the two residues
R.sub.n1.sup.3=T.sub.n1.sup.3 (mod n) and R.sub.n.sup.3=T.sub.n.sup.3 (mod n).
If either R.sub.n1.sup.32 or 7 (=l.sup.22) and/or R.sup.3.sub.n3, then n can be declared to be composite and the routine stops here.
(36) Note that all composites which are not genuine primes or pseudoprimes or proper cofactors of T.sup.3 will be detected and sieved away in this STEP A.
(37) If R.sub.n1.sup.3=2 or 7(=l.sup.22) (mod n) and R.sub.n.sup.3=3 (mod n) then proceed to STEP B below.
(38) STEP B: This step performs a greatest common factor sieving to sieve away certain pseudoprimes. For example, take a composite n=1729=71319 and l=4. The number 1729 is a pseudoprime of T.sup.4 since
T.sub.1729.sup.4=T.sub.865.sup.4.Math.T.sub.864.sup.4T.sub.1.sup.4=914.Math.8214=4 (mod 1729)
T.sub.865.sup.4=T.sub.433.sup.4.Math.T.sub.432.sup.4T.sub.1.sup.4=641.Math.14584=914 (mod 1729)
(39) Take the odd term right below T.sub.1729.sup.4, that is T.sub.865.sup.4. Since the residue is 914 (mod 1729), subtract from this residue T.sub.0.sup.4 giving 912. Using the Euclidean algorithm for the greatest common factor (gcd), compute gcd (912, 1729)=19. This shows that 1729 is composite since 19 is one of its factors. (Computing gcd by the Euclidean algorithm is useful in factoring.) In other words, for n to be a candidate for prime, the odd term residue R.sub.d.sup.3 right under R.sub.n.sup.3n when 2 is subtracted must at least be coprime to n: gcd(R.sub.d.sup.l2, n)=1.
(40) STEP B still misses some pseudoprimes or cofactor composites but when followed by STEP C, all possible exceptions in the form of proper cofactors or pseudoprimes will be sieved away, leaving only the genuine primes.
(41) STEP C: Find an l which is of opposite l type to that in STEP A in T.sup.3. If in STEP A the l type of n in T.sup.3 is , then in this STEP C, find an l for which the l type of n is + in T.sup.l and vice versa. This can be determined readily through the above-mentioned computations of small residue r or direct computations of R.sub.n1.sup.32 or l.sup.22 (mod n) and T.sub.n.sup.l=l (mod n).
(42) If in STEP A T.sub.n1.sup.32 (mod n) and T.sub.n.sup.33 (mod n), that is, l type, then if for another l in which the l type of n in T.sup.l is opposite to that in T.sup.3 it holds that T.sub.n1.sup.ll.sup.22 (mod n) and T.sub.n.sup.ll (mod n), that is, +l type, it follows that n must be a genuine prime. If the residues are not as just stated, that n is declared to be composite. It is assured that, when n satisfies these conditions, n must be a genuine prime, because for any composite number, n=p.sub.1.Math.p.sub.2 say, it is impossible to satisfy all + and divisibility conditions:
p.sub.11|n1, p.sub.21|n1, p.sub.1+1|n+1, p.sub.2+1|n+1.
Only a genuine prime p can always satisfy these conditions when n=p. This completes STEP C.
(43) A variation of the foregoing algorithm uses the Jacobi to avoid blind trials seeking for opposite l types. In particular, taking JACOBI(l.sup.24, n) gives the l type. One strategy is to calculate the l types beginning with l=3 until the lowest values of l having opposite types have been found.
(44) Primality TestingSummary.
(45) Following the above method of computation ensures that this primality testing algorithm is 100% general, deterministic, provable and polynomial-time. It runs as follows:
(46) The integer n is a genuine prime whenever n satisfies the conditions in these three steps: STEP A: T.sub.n1.sup.32 or 7 (mod n) and T.sub.n.sup.33 (mod n) STEP B: gcd(R.sub.d.sup.32, n)=1 STEP C: T.sub.n1.sup.l2 or l.sup.22 (mod n) and T.sub.n.sup.ll (mod n) where the l type of n in T.sup.l is opposite to that in T.sup.3 as in STEP A.
Failing to satisfy any one or more of these conditions will render n to be composite.
(47) As may be seen from Table 1, the time and memory requirements required to test the primality of integers is very small compared to existing methods, and remains comparatively quite small even when testing primality of integers of unprecedented size.
(48) TABLE-US-00001 TABLE 1 450 Mhz Time Needed Memory PC Bits Digits Seconds Minutes Hours Days MB 1,000 300 0.11 4.01 1,260 378 0.22 4.01 1,587 477 0.44 4.01 2,000 601 0.87 4.02 2,520 757 1.74 4.02 3,175 953 3.49 4.03 4,000 1,201 6.98 4.03 5,040 1,513 13.95 4.04 6,350 1,907 27.90 4.05 8,000 2,402 55.81 4.06 10,079 3,027 1.86 4.08 12,699 3,814 3.72 4.10 16,000 4,805 7.44 4.13 20,159 6,054 14.88 4.16 25,398 7,627 29.76 4.20 32,000 9,610 59.53 4.26 40,317 12,107 1.98 4.32 50,797 15,254 3.97 4.41 64,000 19,219 7.94 4.51 80,653 24,215 15.87 4.65 101,594 30,509 1.32 4.81 128,000 38,438 2.65 5.02
Polynomial-Time Factoring Routine
(49) A promising and viable factoring method is also based on the T-sequences. This method is unlike any previous method.
(50) The T-sequences allow all forms of composites to be factored, without exception, in polynomial time, simply because binary decomposition modulo C is fundamentally polynomial time. So far, mathematicians have only found exponential or sub-exponential time factoring algorithms for composites less than 200 digits, in general, and no polynomial-time factoring exists for even special forms of composites like the Mersenne numbers 2.sup.M1, etc. A simple extension of the T sequences, however, immediately provides just such a polynomial-time factoring algorithm (PTFA) for numerous special form composites with infinite membership.
(51) The gist of this PTFA lies in the natural mathematical interrelationships between the composite C=p.sub.1p.sub.2, periods of its prime factors k(p.sub.1) and k(p.sub.2), residue r and order l.
(52) The periods of the prime factors with respect to l can only take on the patterns p.sub.11, p.sub.1+1 and p.sub.21, p.sub.2+1. Note that one can always flip the l type to change p1 to p+1 and vice versa by trying several pairs of l values.
(53) The first important thing to take advantage of in PTFA is that whenever the period residue r.sub.p lies close to p, it can readily be factored. One numerical example will illustrate this:
(54) Take C=91 (=713). The possible periods k(p.sub.1,2) of 7 and 13 are, for 7, 71=6, 7+1=8, and for 13, 131=12, 13+1=14. When C=91 is divided respectively by each of these four k(p.sub.1,2) the following period residue r.sub.p are obtained: 1, 3, 7, 7, obtained from 91=1 (mod 6), 91=3 (mod 8), 91=7 (mod 12), 91=7 (mod 14). Note how small the period residue r.sub.p for the prime factor 7 with the l type is, namely only 1. This implies that the factor 7 can be sieved out by taking the greatest common factor this way: gcd(R.sub.911.sup.l2, 91)=7. When l=6, 7 takes on a l type. So T.sub.91.sup.6 mod 91 is first computed, which gives 76 as residue. Now T.sub.1.sup.6=6, and 1 is the r.sub.p for 71 in T.sub.91.sup.6. Thus one is able to factor by taking gcd(766, 91)=7. Likewise T.sub.90.sup.672 (mod 91), therefore one can again factor by taking gcd(722, 91)=7 as shown above.
(55) Whenever the periods p+1 or p1 [match?] the composite C in either the above straightforward way or a simple function like the cubic polynomial below, factoring can always be performed by taking gcd(R.sub.f(C).sup.l2, C)=one factor; here, 2 is used when the periods p+1 or p1 divides exactly into f(C) and +2 is used whenever f(C) divided by p+1 or p1 gives a residue of
(56)
as is quite often the case. The expression R.sub.m.sup.l stands for T.sub.m.sup.l (mod C), where m can be any arbitrary term or a function of the composite f(C) to be computed.
(57) Again, to illustrate the this point, when +2 is added to 76 (the residue of T.sub.91.sup.6 mod 91), factorization can be performed by taking
(58)
i.e. 14|917
(59) There are numerous sets of composites that can be factored readily because their factors' periods bear such a simple relationship to C. For example, composites of the form C=p[1+(p+1)(p+2)] can always be factored readily in this way:
(60) gcd(R.sub.C+1.sup.+l2, C)=p. For example, take p=11, C=11 (1+1213)=11157=1727. By trials, quickly select a particular l for which 11 is of the +l type. When l=5, 11 is indeed of +l type. Thus one can compute (mod 1727)=R.sub.1728.sup.5=167 and can factor in this way: gcd(1672, 1727)=11.
(61) For C of the form p[1+(p1)(p2)] there results gcd(R.sub.C1.sup.l2, C)=p, e.g., C=23(1+2221)=2343=10649, enabling the following factorization: gcd(R.sub.106491.sup.l2, 10649)=23. Obviously, one can easily construct or find infinitely many such composites to factor. In general for C=p[1+m(p+1)] where m is any prime or composite, C can always be factored as follows: gcd(R.sub.C+1.sup.+l2, C)=p. For C=p[1+m(p1)], simply take gcd(R.sub.C1.sup.l2, C)=p.
(62) Furthermore, often the period of one prime factor of a composite happens to divide into the other prime factor or factors with a small enough residue, e.g., C=147149=374194. In this example, factoring begins by finding by trial that when C has subtracted from it a small number 2, i.e., 1471492, it gives
(63)
and also
(64)
Factorization then proceeds by taking gcd(R.sub.C2.sup.+l+2, C)=gcd(R.sub.147147.sup.+l+2, 147149)=4197. Again it is obvious that there are infinitely many such composites. Quite often too, when C is multiplied by a small integer, the period of a certain factor can divide exactly into this product of C by a small integer, allowing for ready factorization, e.g., C=4167=2747. Multiplying C by the small integer 3 gives 27473=82441. Originally, 2747=27 (mod 411), and 27 is too large a residue period to readily factor. However, 8241=1 (mod 411), and 1 is definitely small enough, leading to gcd(R.sub.3C1.sup.l2, C)=gcd(R.sub.8240.sup.l2, 2747)=41. This constitutes another infinite set of composites that can be factored in polynomial time through PTFA by a few trials.
(65) A powerful and very general PTFA method results from taking the cubic polynomial function of C to factor. It works as follows:
(66) f(C)=aC.sup.3bC.sup.2cC.sup.1d where 0a,b,c,d4. The method tests all the possible combinations; actually, there are basically just 497 combinations that need to be computed for their respective T.sub.f(C).sup.+l (mod C) because the foregoing expression can be rewritten as f(C)=C(aC.sup.2bCc)d, and since c and d will just be integers taken consecutively, the computation lends itself to use of the identity in T-sequences: T.sub.n+1.sup.l=l.Math.T.sub.n.sup.lT.sub.n1.sup.l. Since 0a, b4, and since when a=0, also b=0 and c=0 in some cases, the results is only 522253=497 combinations basically. Factorization is performed by taking gcd(R.sub.fC.sup.l2, C)=one factor, where f(C) stays positive. Two arbitrary examples will illustrate. Take C=6413469 2223629. Note
(67) TABLE-US-00002 mod 640 mod 642 mod 3468 mod 3470 C.sup.1 269 383 641 2829 C.sup.2 41 313 1657 1421 C.sup.3 149 467 929 1749
(68) Taking a=1, b=+3, c=1 and d=3, 641 can be factored out by selecting one l for which 641 is of l type such as l=3: since 22233629=269 (mod) there results 149+3412693=(269).sup.3+3(269).sup.22693=(2223629).sup.3+3(2223629).sup.222236293=f(C). Thus 641 can be factored out as follows: gcd (R.sub.f(C).sup.32, C)=641.
(69) As another arbitrary example, take C=456710837=49492579. Note the fixed relationship between the period residues of each prime factors, particularly when they are the RSA form of two prime composites, e.g., when C=p.sub.1(mod p.sub.2+1), where p.sub.2 is the larger prime and p.sub.1 is the smaller prime factor. This is only one of the relationships that have been found. Others abound, such as the 641 residue under mod 3468 above and also the 4567 residue under mod 10836 here.
(70) TABLE-US-00003 mod 4566 mod 4568 mod 10836 mod 10838 49492579.sup.1 1705 2867 4567 6271 49492579.sup.2 3049 1857 9025 5177 49492579.sup.3 2437 2299 7867 5157
(71) Again trials show that when a=3, b=4, c=3, d=4, 4568|3C.sup.34C23C4=f(C). Thus a sieve action is achieved by selecting one l for which 4567 carries +l type, e.g., l=3. Factorization is performed by taking gcd(R.sub.C+1.sup.+l2, C)=4567.
(72) This formula can be linked to the fundamental Diophantine Equation (p1)xR.sub.py=d where p and R.sub.p are related by C=R.sub.p(mod p1). This kind of Diophantine Equation is always solvable, e.g., in the previous example 640307526973167=+3, giving much theoretical strength to this formula. Also, this method bears a strikingly close relationship to the elliptic curve method. It is general and always polynomial time. No counterexamples have so far been found. Also very effective are the above-mentioned small residue factoring sieve as well as a quadratic polynomial factoring sieve not described here. Composites of an arbitrary number of prime factors can be handled and factored too. A 100% complete and efficient PTFA should be based upon such a formula or similar one.
(73) In addition to the above methods, other factoring methods have been programmed and tested such as:
(74) (A). R.sub.n.sup.l=T.sub.n.sup.l (mod n) is factored by taking a(R.sub.n.sup.l).sup.2bR.sub.n.sup.lc (mod n). Taking the gcd of this relation minus 2 allows for factoring. Here 1a4, 4b, c+4 and a0. E.g., take
(75)
Take 851=R, which comes from 64570081=851 (mod 18711) and 1870|2(851).sup.2+8513 (=1870775). Thus factorization can be performed by taking gcd (R.sub.2.Math.n.sub.
(76) (B). Compute the four possible residues: (a) R.sub.n.sup.l (mod n), (b) R.sub.n.sup.l (mod l.Math.n), (c) R.sub.l.Math.n.sup.l (mod n) (d) R.sub.l.Math.n.sup.l (mod l.Math.n). Use the residues as inputs for one or more layers of T-sequence modulo computation. Then factor by taking gcd (R.sub.l.Math.nR.sub.
R.sub.2077.sup.3719 (mod 2077)(a)
R.sub.2077.sup.32796 (mod 6231)(b)
R.sub.6231.sup.31190 (mod 2077)(c)
R.sub.6231.sup.33267 (mod 6231)(d)
When e=1, f=1, l=+ for 67, e.g., l=3 there results
12077+(3267719)1=4624=6868.
Factor by taking gcd(R.sub.4624.sup.32, 2077)=(26822, 2077)=67.
(77) (C) Another method makes use of the recursive period pattern of certain primes, e.g., n=2701=3773. First compute T.sub.2701.sup.31239 (mod 2701), T.sub.2702.sup.31749 (mod 2701) Square the larger, even term such as 2702 then subtract 2 (=T.sub.0), always (mod n), to compute the next even term. For the odd term such as 2701, to compute the next odd term, multiply the odd term by the larger even term and then subtract l, e.g., (1) 1239 (odd), 1749 (even)(2) 806 (odd), 1467 (even), where 123917493=806 (mod 2701) and (1749).sup.22=1467 (mod 2701). Carry on these computations recursively until there emerges a repetitive pattern. Then often factoring can be performed by taking the gcd, e.g., gcd(8063, 270)=73, also gcd(14677, 2701)=73.
(78) (D) Whenever the ratio between the two factors of the composite n is less than 2, one can always factor by adding or subtracting from n by the nearest integer [{square root over (4n4)}], whereupon the residue (mod p1) is zero or just 1 away from p+1 or p1,e.g., 3743=1591 and
(79)
Compute [{square root over (4.Math.15914)}]=80 and 1591-80=1511. By finding l such as l=4 where 37 is l type but not 43, factorization is made possible by taking 1511+1=0 (mod 371), i.e., gcd (R.sub.1591[{square root over (4.Math.15914)}]+12, 1591)=37. There are again infinite number of composites with this convenient property, or the factors can be made to lie close in size to one another by simply multiplying the composite by a suitable small integer.
FactoringSummary.
(80) T-sequences are closely tied in to factoring. There have been described several very promising polynomial-time factoring methods. The cubic polynomial, PTFA seems to work the best, but other lines of attack are feasible too.
(81) Prime Number Formula.
(82) Traditionally, a prime number formula (which has never been found) has always had these requirements:
(83) 1) It always gives a prime number for each integer input n=1, 2, 3, 4, . . .
(84) 2) It is constructive, i.e., the formula can always be computed to give prime numbers. For example, Mills' formula p=[A.sup.3.sup.
(85) 3) It is forthright, i.e., it takes little time to readily compute the prime number. For example, for the polynomial equation ax.sup.2+bx+c=0, the formula
(86)
is forthright in that it gives the roots readily.
(87) On the face of it, these requirements seem natural enough. Seekers of prime number formula have always exerted their best efforts to find a prime number formula that satisfies these three requirements. The continuing failure to find such a prime number formula has caused many researchers to conclude no such formula exists.
(88) While it appears doubtful that a prime number formula of this type can be constructed, upon reflection, it may be seen that the third requirement is inconsistent with the very definition of prime numbers, namely that they cannot be divided exactly by any other numbers other than themselves and 1. The implication is that the primality of a positive integer n needs to be determined by a legitimate polynomial-time primality testing algorithm. Whether n is prime or composite cannot be ascertained right away. Rather, n must be tested for primality. A prime number formula which is supposed to generate primes and not composites also needs to obey such a fundamental requirement.
(89) Now redefine a prime number formula as one that satisfies the three requirements:
(90) 1) It always gives a prime number for each integer input n=1, 2, 3, . . .
(91) 2) It is always constructive.
(92) 3) It possesses polynomial-time complexity.
(93) Since a prime number formula is in essence one version of a primality testing algorithm; whereas the traditional formulation of a prime number formula is an NP problem, the foregoing formulation recast the problem such that NP.fwdarw.P.
(94) A new prime number formula of the type described may be arrived at by making use of a revised version of the Fortune Conjecture, i.e., P.sub.i+1P.sub.1P.sub.2P.sub.3 . . . Pi is always a prime. This can be shown to be equivalent to the conjecture that the smallest gap between two consecutive primes P.sub.i+1 and Pi is (ln P.sub.i ln ln P.sub.i).sup.2. If this gap is simplified to ln.sup.2P.sub.i, then following Euclid's celebrated proof for the infinity of prime numbers, one can easily show that Fortune Conjecture is equivalent to this smallest gap conjecture. The validity of these two conjectures are well substantiated empirically as well as theoretically. It is known that the maximum gap between two consecutive primes must be rounded by the order of ln P.sub.i. Any such logarithmic gap will do just fine for the following prime number formula gap or range: g=(ln P.sub.1.sup.aP.sub.2.sup.b . . . P.sub.i.sup.x).sup.2. According to Fortune/Smallest Gap Conjecture there is at least one prime between Q and Q+g. The method therefore needs to compute only these sums: Q+P.sub.i+1, Q+P.sub.i+2, Q+P.sub.j, where P.sub.j is the largest prime smaller than g. There is at least one prime among these sums, and by applying the primality testing method described previously, the primality of each sum can be determined rapidly. Actually, it is also useful to compute the differences: QP.sub.i+1, QP.sub.i+2, . . . QP.sub.j. It turns out that practically all such differences give not just one but many primes within the range.
(95) One numerical example illustrates this formula clearly:
(96) Let P.sub.1=2, P.sub.2=3, P.sub.3=5, and a=2, b=1, x=2. Then Q=P.sub.1.sup.aP.sub.2.sup.bP.sub.3.sup.x=2.sup.2.Math.3.Math.5.sup.2=300, (ln 300).sup.232.5. That means there is a need to compute only these numbers 3007, 30011, 30013, 30017, 30019, 30023, 30029, 30031. (The numbers 3001 are not computed here). Among these 16 numbers, the foregoing primality testing algorithm or a similar algorithm enables us to sieve out 11 prime numbers. The conjecture tells us that there are at least two primes. The method obtains 11 out of 16; this is a high yield of primes. In fact, even for big numbers this formula or sieve will still yield large quantities of primes consistently, with an estimated or 36.78% of the sums and differences being prime. One condition which must be observed at all times is that ln P.sub.1.sup.aP.sub.2.sup.b . . . P.sub.i.sup.x must always be smaller than the next prime after P.sub.i, that is P.sub.i+1.
(97) One can also add or subtract a large product with a small product e.g. 2.sup.2.Math.3.Math.5.sup.2=300 and 2.sup.2.Math.3=36, giving 300+36=336. The smallest gap in this case will be determined by (In 36).sup.2=12.84. Among the differences 3365=331 is found to be prime, in line with the conjecture. In short the possible number of candidates for primes can always be minimized so that the greatest number of composites is filtered out beforehand.
(98) Note that Q+P.sub.i can always be arranged in such a way that will best minimize the number of computations needed to sieve out all the primes in any given range. E.g., there is a relatively large gap between 114 and 127. Computing 2.Math.3.sup.2.Math.5+2.sup.3.Math.3=114 would require computation of 114+5, 7, 11, 13, i.e., four steps too many. Instead, choose 2.sup.3.Math.3.Math.5=120 which allows computation of the immediate primes as 120+7=127 and 1207=113. This gives all primes within that range readily while skipping all the composite candidates simultaneously. In fact, using a few trials and checks beforehand, one can always manage to optimize the yield of primes within the range efficiently. Large primes can then be chunked out much faster and consistently, all the time based on this prime number sieving algorithm.
(99) This approach makes it possible to compute a large prime. This formula, along with adding or subtracting suitable sums or differences, will readily generate many other primes around this large prime.
(100) Random Number Generator
(101) Mathematically a good random number generator (RNG) should be infinitely non-periodic, such that no generated number can be deduced from any previous number. Of course, statistical tests like the chi-square test can be applied to ensure that all digits are distributed 100% randomly with no bias whatsoever. Admittedly, if only math is concerned, a fixed input will always yield a fixed output. Only physical systems like the quantum mechanical systems can give dynamically genuine random numbers. Coupling these two notions together, it is possible to construct a powerful and convenient RNG.
(102) First, note the fact that the last digits of all primes, except 2 and 5, can only be 1, 3, 7 and 9. They are distributed absolutely randomly among the infinite set of positive integers. The very definition of prime number demands this, since prime numbers can only be divided exactly by 1 and themselves. Thus by taking the last digits only and ignoring the trivial 2 and 5, from the prime set 3, 7, 11, 13, 17, 19, 23, 29, 31, etc., one obtains the random digits 3, 7, 1, 3, 7, 9, 3, 9, 1, 7, 1, 3, 7, 3, 9, 1, 7, 1, 3, 9, 3, 9, 7 for primes from 3 to 97. These digits form an infinite set, and no digit can be derived from the previous or succeeding ones. Each one of the four digits appears 25% of the time. Above all, they are absolutely non-periodic.
(103) The prime-number formula based on the T-sequence polynomial-time primality testing algorithm provides infinitely many variations of these random prime digits, e.g., take 2357=210. Based on the formula presented previously, add or subtract all the primes between 7<11 and 47<72, to test each sum or difference for primality. From the seed 210 onward one obtains the sums +1, +11, +13, +17, . . . +47 which give this set of random digits: 1, 3, 7, 9, 3, 9, 1, 1, 7 from 211 to 257. The differences 1, 1, 13, 17, . . . 47 give another set of random digits: 9, 7, 3, 1, 1, 9, 3, 3, 7, 3 from 199 back to 163. Of course, the foregoing primality testing algorithm can be used generate an abundance of large primes such as cannot be generated in any other way.
(104) Since the seeds such as 2.Math.3.Math.5 or 2.sup.2.Math.3.sup.2.Math.5.Math.7, etc. can be varied in infinitely many ways, the set of last prime digits can also be generated and arranged in all sorts of arbitrary ways. The seeds can be added or subtracted in any which way too. Without a complete knowledge of the exact seeds and their mathematical operations, no one can reproduce or deduce this type of random digits of the primes. These random digits of primes behave in just as chaotic fashion as the physical sub-atomic particles in their distribution. Therefore this method can conveniently generate any length of random digits or numbers desired to use in mathematical research or industrial simulation. This generator of random digits can be implemented easily and efficiently in both hardware and software. Conventional RNGs such as linear or non-linear feedback shift registers always carry period patterns which are inherent. Non-periodicity is inherent in the foregoing random prime digit generator.
(105) This RNG can also be easily modified into a simple but innovative cipher: a function F.sub.1 (such as transposition, shuffling, etc.) that operates on the last prime digit and another function F.sub.2 that computes and determines the seeds are both kept secret. F.sub.2 is coupled to a simple but chaotic physical system such as dice-throwing, radioactive matter, etc., for the first random input as seeds. The functions F.sub.2 and F.sub.1 are used to generate a truly random string of digits such as 9, 7, 3, 1, 1, 9, 3, 3, 7, 3, 1, 3, 7, 9, 3, 9, 1, 1, 7. This string of random digits can be used as a one-time pad for encryption. The receiver who is informed only of the starting seeds (from the physical system input) can decrypt the ciphertext to obtain the plaintext since he also possesses F.sub.1 and F.sub.2 as well as the relevant table of primes like the sender. As long as F.sub.1 and F.sub.2 are kept secret, no eavesdropper can decrypt the ciphertext. The cipher can even be timed accordingly so that the functions F.sub.1 and F.sub.2 change according to time changes or context changes. In any event, math theory about primes guarantees that the string of random digits thus generated are absolutely chaotic. No fixed inter-relationship can be derived from among themselves.
(106)
(107)
(108) It will be appreciated by those of ordinary skill in the art that the invention can be embodied in other specific forms without departing from the spirit or essential character thereof. The presently disclosed embodiments are therefore considered in all respects to be illustrative and not restrictive. The scope of the invention is indicated by the appended claims rather than the foregoing description, and all changes which come within the meaning and range of equivalents thereof are intended to be embraced therein.