Generating A Primes Using Partitions
Generating A Primes Using Partitions
Abstract: This paper presents a new technique of generating large prime numbers using a
smaller one by employing Goldbach partitions. Experiments are presented showing how this
method produces candidate prime numbers that are subsequently tested using either Miller Rabin
or AKS primality tests.
Introduction
Generation of large prime numbers is fundamental to modern cryptography protocols [1],[2],
generation of pseudorandom sequences [3]-[5], and in new application of these protocols to
multi-party computing and cryptocurrencies [6]-[8]. Public-key cryptography requires random
generation of prime numbers to derive public key. This paper presents a new technique of
generating large prime numbers using a smaller one by employing Goldbach partitions [10]. The
algorithm is described and experiments are presented showing how this method gives large
primes in an effective manner. A candidate prime will be tested using either Miller-Rabin (MR)
or AKS primality tests [11],[12].
45 98
50 159
55 172
60 211
70 224
1
Figure 1. Average of 10 executions to generate a random prime number vs. Length of the prime
number. X-axis: Length of the prime number, Y-Axis: Average Attempts.
The average number for 10 executions increases with the size of the number, and it ranges from
about 100 for a 45-digit number to 224 for a 70-digit number.
Generating primes using Goldbach partitions
The method of prime number generation using Goldbach partitions is now presented. Let g(n) be
the number of unique ways n can be expressed as p + q, where p and q are primes. The partition
function g(n) has a local maximum for multiples of primes. We obtain local maximum at
multiples of primes such as 2x3 = 6; 2x3x5 = 30; 2x3x5x7 = 210; 2x3x5x11 = 330; 2x3x5x13 =
390; 2x3x5x17= 510; 2x3x5x19 = 570; 2x3x5x7x11 = 2310; 2x3x5x7x11x13 = 30030;
2x3x5x7x11x13x17 = 510510, etc. For n=, prime numbers in the range [n/2, n-2] are among the
partitions. The number n=210 is the largest number where all numbers in Goldbach partitions are
prime numbers.
Example for n=30: the Goldbach partitions are (23, 7), (19, 11) and (17, 13).
Example for n=210: the Goldbach partitions are (199,11), (197,13), (193,17), (191,19), (181,29),
(179,31), (173, 37), (167, 43), (163, 47), (157, 53), (151, 59), (149, 61), (139, 71), (137, 73),
(131, 79), (127, 83), (113, 97), (109, 101), (107, 103). If one counted from the smaller prime up
then (187,23) is one pair that is left out since 187 is not prime.
Since we are interested in generating candidate primes, we define h(n) as the count of all primes
in the range [n/2, n-2].
h(n) g (n).
Table 2 presents the number of candidate partitions in the range [n/2, n-2] obtained by the
product of prime numbers for some values of n.
2
Table 2. Number of candidate partitions, h(n)
Prime n No. of Prime Numbers n No. of
Numbers Candidate candidate
Partitions Partitions
h(n) h(n)
2,3,5 30 3 2,3,5,23 690 56
3
The graphs below compares the value of n and the number of candiate partitions computed.
4
Table 3 Percentage of Prime Partitions
42 80 798 63.30
The graphs below presents the percentage of prime numbers generated from the Goldbach
partitions.
5
Figure 4. No. of candiate partitions vs percentage of primes for n<1000
n: p , p =2,3,5,7,…..i
i 1 i
pb: n - pa
If p b prime
Then
Prime = true
EndWhile
Return p b .
45 4 21
45 5 18
45 6 20
45 7 15
45 8 18
45 9 15
60 4 10
60 5 16
7
60 6 12
60 7 18
60 8 12
60 9 14
Conclusions
This paper has proposed a new method of generating prime candidates using partitions, which
are then tested using primality testing algorithms (MR and AKS). We provide results on the
8
efficiency of this algorithm. The use of the GPGA method reduced the number of trials in the
search for primes by a factor of nearly 10 for primes ranging from 45 to 70 digits long.
References
1. W. Diffie and M. Hellman, New directions in cryptography. IEEE Trans. Inf. Theory, 1976.
2. S. Singh, The Code Book: the Secret History of Codes and Code-breaking. Fourth Estate,
London, 1999.
3. S. Kak, Classification of random binary sequences using Walsh-Fourier analysis. IEEE
Trans. on Electromagnetic Compatibility, EMC-13: 74-77, 1971.
4. S. Kak and A. Chatterjee, On decimal sequences. IEEE Trans. on Information Theory IT-27:
647 – 652, 1981.
5. S. Kak, Encryption and error-correction coding using D sequences. IEEE Trans. on
Computers C-34: 803-809, 1985.
6. S. Kak, The piggy bank cryptographic trope. Infocommunications Journal 6: 22-25, 2014.
7. B. Prashanth Reddy, A review of the bitcoin network security framework. 2015.
https://subhask.okstate.edu/sites/default/files/prashanthcrypto.pdf
8. I. Miers. and C. Garman., M. Green., A. D. Rubin, Zerocoin: Anonymous distributed e-cash
from bitcoin, IEEE Symposium on Security and Privacy, 2013.
9. L. Washbourne, A survey of P2P Network security. arXiv:1504.01358, 2015
10. S. Kak, Goldbach partitions and sequences. Resonance 19: 1028-1037, 2014.
11. M. Agrawal, N. Kayal and N. Saxena, PRIMES is in P, Ann. of Math. (2) 160, 781-793,
2004.
12. R. Crandall and J. Papadopoulos, On the implementation of AKS-cClass Primality tests, 18
Mar 2003.
13. G.H Hardy, E.M. Wright , An Introduction to the Theory of Numbers, 2008.
14. A. Kak, Computer and Network Security, Purdue University, 2015.
15. S. Kak, A primes conjecture, 2015.
http://subhask.okstate.edu/sites/default/files/primes_conjecture.pdf
16. A. Atkin, D.J. Bernstein, Prime sieves using binary quadratic forms, Mathematics of
Computation 73: 1023–1030, 2004.
17. P. Pritchard, Improved incremental prime number sieves. Algorithmic Number Theory
Symposium, pp. 280–288, 1994.
18. J.P. Sorenson, Trading time for space in prime number sieves. Lecture Notes in Computer
Science 1423: 179–195, 1998.
19. P.S. Potluri, A review of anonymous file sharing on the cloud.
https://subhask.okstate.edu/sites/default/files/pushpa5.pdf
20. D. Eastlake 3rd, S. Crocker, J. Schiller, Randomness Recommendations for Security.
Network Working Group, MIT, 1994.