Abstract

We propose a new simple and faster algorithm to factor numbers based on the nature of the prime numbers contained in such composite numbers. It is well known that every composite number has a unique representation as a product of prime numbers. In this study, we focus mainly on composite numbers that contain a product of prime numbers that are greater than or equal to 5 which are of the form or . Therefore, we use the condition that every prime or composite of primes greater than or equal to 5 satisfies . This algorithm is very fast especially when the difference in the prime components of a composite number (prime gap) is not so large. When the difference between the factors (prime gap) is not so large, it often requires just a single iteration to obtain the factors.

1. Introduction

An integer is prime if and has exactly two positive divisors, namely, 1 and itself [15]. An integer is called a composite if and have more than two positive divisors [69].

Any composite number (integer) can be decomposed into smaller integers called prime factors, for which their multiplication produces the original integer. The process of decomposing such numbers is called integer factorization [7, 1012].

Over the years, the prime factorization of large numbers has drawn much attention due to its practical applications and the associated challenges [13, 14]. In computing applications, encryption algorithms such as the Rivest–Shamir–Adleman (RSA) cryptosystems are widely used for information security, where the keys (public and private) of the encryption code are represented using large prime factors [1521]. Since prime factorization of large numbers is extremely hard, RSA cryptosystems take advantage of this property to ensure information security [10, 22, 23].

Many efforts have been made to develop an effective method of factoring numbers and to know whether a number is prime or not [24, 25]. They include Sieve of Eratosthenes, Pollard’s Algorithm, special-purpose factorization algorithm, general-purpose, Special Generic Factorizations, Williams’ Method, and Lenstra’s Elliptic Curve Method, among others [2, 22, 2630].

1.1. Congruences

We say that divides if there is some integer such that . If divides , we write , and if does not divide we write .

If , we writeand say that is congruent to modulo . The quantity is called the modulus and all numbers congruent (or equivalent) to are said to constitute a congruence (or equivalence) class [7, 3133]. According to [34], an algorithm is a precise step-by-step series of rules that leads to a product or to the solution to a problem. Some steps in an algorithm depend on what happened or was learned in earlier steps.

2. The Main Result

Let and be prime numbers greater than or equal to 5. Porras Ferreira and Willian De Jesus [35] proved that prime numbers and are representatives of or implying

Then, for some integers and ,

Now, as it was earlier proven by Porras Ferreira and Willian De Jesus [35] that if is a composite of primes greater or equal to 5, then .

Theorem 1. Let be a composite containing at least one prime ; then,where is a positive integer.

Proof. Let (where i = 1, 2, ..., n) be primes greater or equal to 5 and be a prime less than 5 such that be a composite of primes.
Since and are positive integers, thenFrom the property in [7] of multiplication, then multiplying in (5) together, we obtainMultiplying both side in (6), we obtainHowever, implyingThus, the theorem is proven.
This indicates that any composite number that contains at least one prime less than 5 does not satisfy the condition of .
Therefore, from this point, we can analyze the conditions that will determine any integer to be a prime or a composite.

2.1. Composite of the Form

As stated earlier, not all numbers of the form are primes, now, we prove to back up the statement.

Case 1. Let be a composite of at least two prime say of the form and , that is, :Let be an integer. Then,

Case 2. Let be a composite of at least two primes of the form and ; that is, :Let an integer. Then,

2.2. Composite of the Form

Let be a composite of at least two primes of the form and ; that is, :

Let an integer. Then,

Equations (10), (12), and (14) really show that not all numbers of the form or are primes. Some of which are pseudoprimes and others just ordinary odd numbers.

As we can observe from the above mentioned equations, the values of and will determine whether the number is prime or not a prime.

We also observe that it is difficult to distinguish between composites of the form and because they both give the same result, that is, .

2.3. Composites of the Form and Their Factorization

Case 3.

Theorem 2. LetThen, there exists some integer such that

Proof. FromThen,Dividing through by 6, we obtainNow, let and implying that 20 becomesHence, we obtain

Lemma 1. If , then either or is a solution (trivial solution) to (16).

Proof. Let . We know that . Then, it implies that :Thus, or .
When or when , therefore, and 0 is the trivial solution to (16).

Corollary 1. Let be a number of the form for any integer ; then, for some is a prime, if and only if and 0 (trivial solution) is the only solution to (16).

Proof. can be written in the form and clearly; if and 0 is the only solution, thenConversely, let be a prime. Clearly, ; thus, is the solution.

Corollary 2. If has at least one more integral solution other than the trivial, then is a composite.

Proof. Suppose there exists a suitable value of say . Then, .
Let ; then, :We use the quadratic formula given byIf the integer numbers for exist say are integers, thenThus, it is a composite.

2.4. Factorizing the Composite of Case 3

Suppose is a composite with at least two prime factors; then, there exists some positive integer such that as in (17). Letsuch that is divisible by 6, where and is the smallest positive residue. Then,where .

From (28) and (29), we obtain

Since we are interested in the positive integer solution, then

By expanding, we obtain

Then, let be the least positive integer solution for satisfying (32). Then, , where . This implies that for the real solution in (30).

Substituting in (30), we obtain

However, we know that has at least one prime factor not exceeding [36]. Then, , or . Substituting for in (33) to determine the maximum value for , we obtain

For maximum , we choose the negative integer solution of in (32).

Suppose is the negative value of ; then, we obtain

Then, we can now obtain the exact integer solution for recursively in simply iterations, where is the error in .

During the iterations, we may reach a point when we cannot obtain the integer solution for , and as we reach , the values of tend to converge to some real number say , and this requires us to do more iteration so that we can reach at least . So, to reduce the iterations, we decide to simply list down the remaining values of if right from 1 to and do the trial divisions, and this is the error we assume to be .

When we obtain exact integer solutions for , then it implies that, at least one of the values gives a prime or a number that divides .

Case 4.

Theorem 3. LetThen, there exists some integer such that

Proof. FromthenDividing through by 6, we obtainNow, let and imply that (41) becomesHence, we obtain

Lemma 2. If and is divisible by 5, then is divisible by 5.

Proof. Let . We know that . Then, it implies that :Thus, or .
When or when , since we know that 5 divides , now, let ; substituting for either or in equation (37),Thus, in (37) is divisible by 5, and therefore, is not a prime.

Corollary 3. If has at least a nonzero integer solution, then is a composite.

Proof. Suppose there exists a suitable value of say . Then, .
Let . Then, :We use the quadratic formula given byThus, a composite provided the values for and are integers.
Clearly, if the values of and are not integers, then is a prime.

2.5. Factorizing the Composite of Case 4

Suppose is a composite. Then, there exists some positive integer such that as in (38). Letsuch that is divisible by 6, where and is the smallest positive residue. Then,where

From (48) and (49), we obtain

Since we are interested in the positive integer solution, then

By expanding, we obtain

Then, let be the least positive integer solution for satisfying (52). Then, , where . This implies that for the real solution in (50).

Substituting in (50), we obtain

However, we know that ; then, . Substituting for in (53) to determine the maximum value for , we obtain

For maximum , we choose the negative integer solution of in (52).

Suppose is the negative value of ; then, we obtain

Then, we can now obtain the exact integer solution for recursively in simply iterations. When we obtain exact integer solutions for , then it implies that at least one of the values gives a prime or a number that divides .

3. Composites of the Form and Their Factorization

Theorem 4. Let ; then, there exist some integer such that

Proof. FromthenDividing through by 6, we obtainLet and ; then,implying

Lemma 3. If , then either or is a trivial solution to (56).

Proof. LetThen,implying thatThus, or , when and when .

Corollary 4. When the trivial solution in Lemma 3 is the only solution to (56), then is either prime or divisible by 5.

Proof. From (56), we need to show that is either divisible by 5 or has exactly two divisors that is 1 and itself:When , thenThen, is divisible by 5, provided 5 divides .
Or when , thenImplying if (56) has only a trivial solution, then 1 and are the only divisors of .

Corollary 5. If there exists one more solution (nontrivial solution) of (56), then is a multiple of primes greater than or equal to 5.

Proof. Let and be the suitable integers such that and ; then,Applying quadratic formula, we obtainThe solution is either or .
Substituting the solution in (56), we obtainorThus, is a composite provided and are integers.

3.1. Factorizing the Composite

Suppose is a composite. Then, there exists some positive integer such that as in (56).

Letsuch that is divisible by 6, where and is the smallest positive residue. Then,where .

From (72) and (73), we obtain

Since we are interested in the positive integer solution, then

By expanding, we obtain

Then, let be the least positive integer solution for satisfying (76). Then, , where . This implies that for the real solution in (75). Substituting in (75), we obtain

However, we know from [7] that ; then, . Substituting for in (77) to determine the maximum value for , we obtain

For maximum , we choose the negative integer solution of in (76).

Suppose is the negative value of ; then, we obtain

Then, we can now obtain the exact integer solution for recursively in simply iterations. When we obtain exact integer solutions for , then it implies that at least one of the values gives a prime or a number that divides .

4. General Outline of the Algorithm

We outline the steps of factorizing primes based on the proofs above.

Given an integer (1)Check if satisfies .(2)Does (1) hold? If so, do step (4), and if not, do step (3).(3)Check if it is either divisible by 2 or by 3 and reduced it by dividing by 2 or 3 until the Quotient is no longer divisible by 2 or 3. If the resulting Quotient is greater than 3, we can call it and do step (4).(4)Check if is either of the form or by subtracting 1 or 5 from and check if the difference is divisible by 6.(5)If is of the form , thenEither Case 3(i)We determine integer from .(ii)We write down the congruence:(iii)We determine and , where is the least positive residue such that is a positive integer(iv)We obtain the least positive integer such that has a real solution. This is obtained from .(v)We obtain the integer from , where .(vi), , , and  If the integer solution does not exist at , we do step (vii)(vii)We perform at most iterations to obtain the integer solutions for from Remark: If the values of seem to converge at some point on a real line, then it is better to list the integer values of from the point of convergence (integer value of convergence) to as small as 1; that is, if the integer value of convergence of is , then we list them such that and do the trial divisions from . If there is no integer value of such that is an integer, then we try Case 4.OR Case 4(i)We determine integer from .(ii)We write down the congruence:(iii)We determine and , where is the least positive residue such that is a positive integer.(iv)We obtain the least positive integer such that has a real solution. This is obtained from .(v)We obtain the integer from , where .(vi), , , and . If the integer solution does not exist at , we do step (vii).(vii)We perform at most iterations to obtain the integer solutions for from Remark: If the values of seem to converge at some point on a real line, then it is better to list the integer values of from the point of convergence (integer value of convergence) to as small as 1; that is, if the integer value of convergence of is , then we list them such that and do the trial divisions from . If there is no integer value of such that is an integer, then is a prime.(6)If is of the form , then(i)We determine integer from .(ii)We write down the congruence:(iii)We determine and , where is the least positive residue such that is a positive integer.(iv)We obtain the least positive integer such that has a real solution. This is obtained from .(v)We obtain the integer from , where .(vi), , , and . If the integer solution does not exist at , we do step (vii).(vii)We perform at most iterations to obtain the integer solutions for from Remark: if the values of seem to converge at some point on a real line, then it is better to list the integer values of from the point of convergence (integer value of convergence) to as small as 1; that is, if the integer value of convergence of is , then we list them such that and do the trial divisions from . If there is no integer value of such that is an integer, then is a prime.

Example 1. We consider the factorizing of number 1099551473989:For real solution for , we obtain :Using , then .
From , we obtainThen, or , and therefore, the prime divisors of 1099551473989 are 1048601 and 1048589.
The above procedures (general outline) can be summarized by the flowcharts in Figures 13, respectively.

4.1. Algorithm for Numbers of the Form : Case 3

, , , , ,

4.2. Algorithm for Numbers of the Form : Case 4

, , , ,

4.3. Algorithm for Numbers of the Form : Case 4

, , , ,

5. Conclusion and Recommendations

This method is good especially when the difference (prime gap) between the prime divisors if relatively small.

Remark 1. Normally, when the prime divisors are close to each other, values of are integer solutions. However, this may not guarantee for all such problems.
The algorithm is effective in prime factorization and primality testing, especially when dealing with relatively large numbers. However, there is need for a way of differentiating numbers of the form from numbers of the form because the end result is of the form which makes it difficult to choose which algorithm is suitable for such numbers. This forces one to randomly select either Case 3 formula or Case 4 which makes it more tiresome in case the first algorithm does not produce any result so you turn to another case before making any conclusion about the given problem.
In addition, this algorithm requires a computer program so that it carries a greater impact in the field of cryptography and mathematics.

Data Availability

The figures data used to support the findings of this study are included within the article.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

The author thank Dr. Osman, Prof Mogtaba M, and Dr. M. Sala for reading the work and helping prepare it and is indebted to them.