
Prime Numbers
.pdf
Appendix BOOK PSEUDOCODE |
545 |
for(j = q; j < B; j = j + p) task(); |
// C-style loop form. |
Assuming q is an integer, the above loop means that j takes on the values q, q + p, q + 2p, . . . , q + kp, where k is the largest integer strictly less than (B−q)/p. Algorithm 3.2.1 is an example of the use of this more general C loop. Incidentally, for nonprogrammers there is a good rule of thumb for dispelling confusion on the question: Exactly when do the innards of this general loop execute? Looking at the for() loop above, we can phrase the rule as: The task() is never allowed to execute when the middle conditional is false, i.e. if j ≥ B the loop innards will not execute for such a j value and the loop terminates. Another rule is: The incrementing j = j + p occurs after a pass of the loop innards (throughout our pseudocode we assume the innards do not further modify the running variable). So one can see that after any pass of the loop’s innards, j is increased by p, and then the middle conditional is checked.
Program control
Our pseudocode is to be executed starting at the top, although sometimes we merely place callable functions/procedures there; in such cases the order of placement is irrelevant, and we actually begin execution at the first obvious label that occurs after functions/procedures are defined. In any case we intend the pseudocode statements to follow labels that appear in brackets [ ], like so:
3. [Test p for primality] Indented statement; Indented statement;
. . .;
with the statements executed in serial, downward fashion (unless of course there is a goto [Another label]; see below on “goto”). It is important to note that in such a label as [Test p . . .] above, we do not intend execution to happen right at the label itself. The label is never an executable statement. (This is much the same as with comments set o by “//” in which tasks are described rather than performed.) In the above example we expect primality testing to occur somewhere below the label, via actual indented statements.
Thus we have given labels “in English,” intending them to be thematic of the pseudocode to follow, up to the next label. The serial, downward order is absolute; for example, the above label or any label for that matter can be interpreted as [Next, test p . . .]; in the case of function/procedure definitions a label means [Next, define a function/procedure].
In some instances the pseudocode has been simplified by the use of “goto” statements, as in “goto [Test p . . .],” which directs us to the indicated label where we start executing in downward order from that new label.
All of our pseudocode loops use braces { and } to denote begin/end of the loop innards. This use of braces is independent of their use to denote sets. Also the use of braces to indicate the operational block for a function or procedure (see next section) is independent of the set notation.
546 |
Appendix BOOK PSEUDOCODE |
Functions and return/report values
Typically a customized function in our pseudocode is cast in the form
f unc(x) {
. . . ;
. . . ; return y;
}
and the idea is the same as in most any modern language: One calls f unc(x) in the same way one would call a trigonometric function or a square root, with the attained value y. Similarly, a procedure (as opposed to a function) has the same syntax, with no returned value, although certain variables are usually set within a procedure. Also, a return statement is an exit statement, e.g., a sequence
if(x =y) return x3; return x4;
does not need an “else” structure for the x4 case, because we always assume the current function/procedure exits immediately on any demand by the if() statement here. Likewise, a return statement, when executed, immediately causes exit from within any while() or for() loop.
Finally, we use report statements in the following way. Instead of returning a value from a function/procedure, a report statement simply relays the value—as in printing it, or reporting it to another program—on the fly, as it were. Thus the following function exemplifies the use of report/return (the function assumes a subroutine that evaluates the number-of-divisors function d(n)):
mycustomπ(x) { |
//Report (and count!) all primes not exceeding x. |
c = 0; |
//This c will be the primes count. |
for(2 ≤ n ≤ x) { |
|
if(d(n) == 2) { |
|
c = c + 1; |
|
report n; |
//As in “print” n, but keep looping. |
} |
|
} |
|
return c;
}
Primes will be reported in ascending order, with the return value of function mycustomπ(x) being the classical π(x).
References
[Adleman and Huang 1992] L. Adleman and M.-D. Huang. Primality testing and abelian varieties over finite fields, volume 1512 of Lecture Notes in Mathematics. Springer–Verlag, 1992.
[Adleman 1994] L. Adleman. The function field sieve. In L. Adleman and M.-D. Huang, editors, Algorithmic Number Theory: Proc. ANTS-I, Ithaca, NY, volume 877 of Lecture Notes in Computer Science, pages 108–121. Springer–Verlag, 1994.
[Adleman and Lenstra] L. Adleman and H. Lenstra, Jr. Finding irreducible polynomials over finite fields. In Proc. 18th Annual ACM Symposium on the Theory of Computing, pages 350–355, 1986.
[Adleman et al. 1983] L. Adleman, C. Pomerance, and R. Rumely. On distinguishing prime numbers from composite numbers. Ann. of Math., 117:173–206, 1983.
[Agarwal and Cooley 1986] R. Agarwal and J. Cooley. Fourier transform and convolution subroutines for the IBM 3090 vector facility. IBM Journal of Research and Development, 30:145–162, 1986.
[Agrawal 2003] M. Agrawal. PRIMES is in P. http://www.fields.utoronto.ca/audio/02-03/agrawal/agrawal/.
[Agrawal et al. 2002] M. Agrawal, N. Kayal, and N. Saxena. PRIMES is in P. http://www.cse.iitk.ac.in/news/primality.html.
[Agrawal et al. 2004] M. Agrawal, N. Kayal, and N. Saxena. PRIMES is in P. Ann. of Math., 160:781–793, 2004.
[Aho et al. 1974] A. Aho, J. Hopcroft, and J. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.
[Alford et al. 1994a] W. Alford, A. Granville, and C. Pomerance. There are infinitely many Carmichael numbers. Ann. of Math., 139:703–722, 1994.
[Alford et al. 1994b] W. Alford, A. Granville, and C. Pomerance. On the di culty of finding reliable witnesses. In L. Adleman and M.-D. Huang, editors,
Algorithmic Number Theory: Proc. ANTS-I, Ithaca, NY, volume 877 of
Lecture Notes in Computer Science, pages 1–16. Springer–Verlag, 1994.
[Alford and Pomerance 1995] W. Alford and C. Pomerance. Implementing the self-initializing quadratic sieve on a distributed network. In
Number-theoretic and algebraic methods in computer science (Moscow, 1993), pages 163–174. World Scientific, 1995.
[Alt 1979] H. Alt. Square rooting is as di cult as multiplication. Computing, 21:221–232, 1979.
548 |
REFERENCES |
[Apostol 1986] T. Apostol. Introduction to Analytic Number Theory, 3rd printing. Springer–Verlag, 1986.
[Arazi 1994] B. Arazi. On primality testing using purely divisionless operations.
The Computer Journal, 37:219–222, 1994.
[Archibald 1949] R. Archibald. Outline of the history of mathematics. Amer. Math. Monthly, 56, 1949. The second Herbert Ellsworth Slaught Memorial Paper: supplement to no. 1 issue, 114 pp.
[Ares and Castro 2004] S. Ares and M. Castro. Hidden structure in the randomness in the prime number sequence. Condensed Matter Abstracts, 2004. http://arxiv.org/abs/cond-mat/0310148.
[Arney and Bender 1982] J. Arney and E. Bender. Random mappings with constraints on coalescence and number of origins. Pacific J. Math. 103:269–294, 1982.
[Artjuhov 1966/67] M. Artjuhov. Certain criteria for the primality of numbers connected with the little Fermat theorem (Russian). Acta Arith., 12:355–364, 1966/67.
[Ashworth and Lyne 1988] M. Ashworth and A. Lyne. A segmented FFT algorithm for vector computers. Parallel Computing, 6:217–224, 1988.
[Atkin 1986] A. Atkin. Schoof’s algorithm. Unpublished manuscript, 1986.
[Atkin 1988] A. Atkin. The number of points on an elliptic curve modulo a prime
(i). Unpublished manuscript, 1988.
[Atkin 1992] A. Atkin. The number of points on an elliptic curve modulo a prime (ii). Unpublished manuscript, 1992.
[Atkin and Bernstein 2004] A. Atkin and D. Bernstein. Prime sieves using binary quadratic forms. Math. Comp., 73:1023–1030, 2004.
[Atkin and Morain 1993a] A. Atkin and F. Morain. Finding suitable curves for the elliptic curve method of factorization. Math. Comp., 60:399–405, 1993.
[Atkin and Morain 1993b] A. Atkin and F. Morain. Elliptic curves and primality proving. Math. Comp., 61:29–68, 1993.
[Bach 1985] E. Bach. Analytic Methods in the Analysis and Design of Number-Theoretic Algorithms. A 1984 ACM Distinguished Dissertation. The MIT Press, 1985.
[Bach 1990] E. Bach. Explicit bounds for primality testing and related problems. Math. Comp., pages 355–380, 1990.
[Bach 1991] E. Bach. Toward a theory of Pollard’s rho method. Inform. and Comput., 90:139–155, 1991.
[Bach 1997a] E. Bach. The complexity of number-theoretic constants. Inform. Process. Lett., 62:145–152, 1997.
[Bach 1997b] E. Bach. Comments on search procedures for primitive roots. Math. Comp., 66(220):1719–1727, 1997.
REFERENCES |
549 |
[Bach and Shallit 1996] E. Bach and J. Shallit. Algorithmic Number Theory, volume I. MIT Press, 1996.
[Baillie and Wagsta 1980] R. Baillie and S. Wagsta , Jr. Lucas pseudoprimes. Math. Comp., 35:1391–1417, 1980.
[Bailey 1990] D. Bailey. FFTs in external or hierarchical memory. J. Supercomp., 4:23–35, 1990.
[Bailey and Crandall 2001] D. Bailey and R. Crandall. On the random character of fundamental constant expansions, Experiment. Math., 10:175–190, 2001.
[Bailey and Crandall 2002] D. Bailey and R. Crandall. Random generators and normal numbers. Experiment. Math., 11:527–546, 2002.
[Bailey et al. 2003] D. Bailey, J. Borwein, R. Crandall, and C. Pomerance. On the binary expansions of algebraic numbers. Journal de Theorie des Nombres, Bordeau (to appear), 2003.
[Balasubramanian and Nagaraj 1997] R. Balasubramanian and S. Nagaraj. Density of Carmichael numbers with three prime factors. Math. Comp., 66:1705–1708, 1997.
[Balazard et al. 1999] M. Balazard, E. Saias, and M. Yor. Notes sur la fonction ζ de Riemann. II. Adv. Math., 143:284–287, 1999.
[Balog 1989] A. Balog. On a variant of the Piatetski-Shapiro prime number theorem. In Groupe de travail en th´eorie analytique et ´elementaire des nombres, 1987–1988, volume 89-01 of Publ. Math. Orsay, pages 3–11. Univ. Paris XI, Orsay, 1989.
[Barrett 1987] P. Barrett. Implementing the Rivest Shamir and Adleman public key encryption algorithm on a standard digital signal processor. In
A. Odlyzko, editor, Advances in Cryptology, Proc. Crypto ’86, volume 263 of Lecture Notes in Computer Science, pages 311–323. Springer–Verlag, 1987.
[Bateman et al. 1989] P. Bateman, J. Selfridge, and S. Wagsta , Jr. The new Mersenne conjecture. Amer. Math. Monthly, 96:125–128, 1980.
[Bays and Hudson 2000a] C. Bays and R. Hudson. Zeroes of Dirichlet L-functions and irregularities in the distibution of primes. Math. Comp., 69:861–866, 2000.
[Bays and Hudson 2000b] C. Bays and R. Hudson. A new bound for the smallest x with π(x) > li (x). Math. Comp., 69:1285–1296, 2000.
[Bernstein 1997] D. Bernstein. Multidigit multiplication for mathematicians, 1997. em Advances Appl. Math., to appear. http://cr.yp.to/arith.html#m3.
[Bernstein 1998] D. Bernstein. Bounding smooth integers (extended abstract). In [Buhler 1998], pages 128–130.
[Bernstein 2003] D. Bernstein. Proving primality in essentially quartic time. http://cr.yp.to/ntheory.html#quartic.
[Bernstein 2004a] D. Bernstein. Scaled remainder trees. http://cr.yp.to/papers.html#scaledmod.

550 |
REFERENCES |
[Bernstein 2004b] D. Bernstein. Factorization myths. http://cr.yp.to/talks.html#2004.06.14.
[Bernstein 2004c] D. Bernstein. Doubly focused enumeration of locally square polynomial values. In High primes and misdemeanours: lectures in honour of the 60th birthday of Hugh Cowie Williams, volume 41 of Fields Inst. Commun., pages 69–76. Amer. Math. Soc., 2004.
[Bernstein 2004d] D Bernstein. How to find smooth parts of integers. http://cr.yp.to/papers.html#smoothparts.
[Bernstein 2004e] D. Bernstein. Fast multiplication and its applications. In J. Buhler and P. Stevenhagen, editors Cornerstones in algorithmic number theory (tentative title), a Mathematical Sciences Research Institute Publication. Cambridge University Press, to appear.
[Berrizbeitia 2002] P. Berrizbeitia. Sharpening “PRIMES is in P” for a large family of numbers.
http://arxiv.org/find/grp math/1/au:+Berrizbeitia/0/1/0/all/0/1.
[Berry 1997] M. Berry. Quantum chaology. Proc. Roy. Soc. London Ser. A, 413:183–198, 1987.
[Berta and Mann 2002] I. Berta and Z. Mann. Implementing elliptic-curve cryptography on PC and Smart Card. Periodica Polytechnica, Series Electrical Engineering, 46:47–73, 2002.
[Beukers 2004] F. Beukers. The diophantine equation Axp + Byq = Czr . http://www.math.uu.nl/people/beukers/Fermatlectures.pdf.
[Blackburn and Teske 1999] S. Blackburn and E. Teske. Baby-step giant-step algorithms for non-uniform distributions. Unpublished manuscript, 1999.
[Bleichenbacher 1996] D. Bleichenbacher. E ciency and security of cryptosystems based on number theory. PhD thesis, Swiss Federal Institute of Technology Z¨urich, 1996.
[Blum et al. 1986] L. Blum, M. Blum, and M. Shub. A simple unpredictable pseudorandom number generator. SIAM J. Comput., 15:364–383, 1986.
[Bombieri and Iwaniec 1986] E. Bombieri and H. Iwaniec. On the order of
ζ(1/2 + it). Ann. Scuola Norm. Sup. Pisa Cl. Sci. (4), 13:449–472, 1986.
[Bombieri and Lagarias 1999] E. Bombieri and J. Lagarias. Complements to Li’s criterion for the Riemann hypothesis. J. Number Theory, 77:274–287, 1999.
[Boneh 1999] D. Boneh. Twenty years of attacks on the RSA cryptosystem.
Notices Amer. Math. Soc., 46:203–213, 1999.
[Boneh and Venkatesan 1998] D. Boneh and R. Venkatesan. Breaking RSA may not be equivalent to factoring. In Advances in Cryptology, Proc. Eurocrypt ’98, volume 1514 of Lecture Notes in Computer Science, pages 25–34. Springer–Verlag, 1998.
[Borwein 1991] P. Borwein. On the irrationality of (1/(qn + r)). J. Number Theory, 37:253–259, 1991.

REFERENCES |
551 |
[Borwein and Borwein 1987] J. Borwein and P. Borwein. Pi and the AGM: A Study in Analytic Number Theory and Computational Complexity. John Wiley and Sons, 1987.
[Borwein et al. 2000] J. Borwein, D. Bradley, and R. Crandall. Computational strategies for the Riemann zeta function. J. Comp. App. Math., 121:247–296, 2000.
[Bosma and van der Hulst 1990] W. Bosma and M.-P. van der Hulst. Primality proving with cyclotomy. PhD thesis, University of Amsterdam, 1990.
[Bosselaers et al. 1994] A. Bossalaers, R. Govaerts, and J. Vandewalle. Comparison of three modular reduction functions. In D. Stinson, editor,
Advances in Cryptology, Proc. Crypto ’93, volume 773 in Lecture Notes in Computer Science, pages 175–186. Springer–Verlag, 1994.
[Boyle et al. 1995] P. Boyle, M. Broadie, and P. Glasserman. Monte Carlo methods for security pricing. Unpublished manuscript, June 1995.
[Bratley and Fox 1988] P. Bratley and B. Fox. ALGORITHM 659: Implementing Sobol’s quasirandom sequence generator. ACM Trans. Math. Soft., 14:88–100, 1988.
[Bredihin 1963] B. Bredihin. Applications of the dispersion method in binary additive problems. Dokl. Akad. Nauk. SSSR, 149:9–11, 1963.
[Brent 1979] R. Brent. On the zeros of the Riemann zeta function in the critical strip. Math. Comp., 33:1361–1372, 1979.
[Brent 1994] R. Brent. On the period of generalized Fibonacci recurrences. Math. Comp., 63:389–401, 1994.
[Brent 1999] R. Brent. Factorization of the tenth Fermat number. Math. Comp., 68:429–451, 1999.
[Brent et al. 1993] R. Brent, G. Cohen, and H. te Riele. Improved techniques for lower bounds for odd perfect numbers. Math. Comp., 61:857–868, 1993.
[Brent et al. 2000] R. Brent, R. Crandall, K. Dilcher, and C. van Halewyn. Three new factors of Fermat numbers. Math. Comp., 69: 1297–1304, 2000.
[Brent and Pollard 1981] R. Brent and J. Pollard. Factorization of the eighth Fermat number. Math. Comp., 36:627–630, 1981.
[Bressoud and Wagon 2000] D. Bressoud and S. Wagon. A Course in Computational Number Theory. Key College Publishing, 2000.
[Brillhart et al. 1981] J. Brillhart, M. Filaseta, and A. Odlyzko. On an irreducibility theorem of A. Cohn. Canad. J. Math., 33:1055–1059, 1981.
[Brillhart et al. 1988] J. Brillhart, D. Lehmer, J. Selfridge, B. Tuckerman, and S. Wagsta , Jr. Factorizations of bn ± 1, b = 2, 3, 5, 6, 7, 10, 11, 12 up to high powers. Second edition, volume 22 of Contemporary Mathematics. Amer. Math. Soc., 1988.
[Bruin 2003] N. Bruin. The primitive solutions to x3 + y9 = z2. http://arxiv.org/find/math/1/au:+Bruin N/0/1/0/all/0/1. J. Number Theory, to appear.
552 |
REFERENCES |
[Buchmann et al. 1997] J. Buchmann, M. Jacobson, Jr., and E. Teske. On some computational problems in finite groups. Math. Comp., 66:1663–1687, 1997.
[Buell and Young 1988] D. Buell and J. Young. The twentieth Fermat number is composite. Math. Comp., 50:261–263, 1988.
[Buhler 1991] J. Buhler, 1991. Private communication.
[Buhler 1998] J. Buhler, editor. Algorithmic Number Theory: Proc. ANTS-III, Portland, OR, volume 1423 of Lecture Notes in Computer Science. Springer–Verlag, 1998.
[Buhler 2000] J. Buhler, R. Crandall, R. Ernvall, T. Mets¨ankyl¨a, and
M. Shokrollahi. Irregular primes and cyclotomic invariants to 12 million.
J. Symbolic Comput., 11:1–8, 2000.
[Buhler et al. 1993] J. Buhler, H. Lenstra, Jr., and C. Pomerance. Factoring integers with the number field sieve. In A. Lenstra and H. Lenstra, Jr., editors, The development of the number field sieve, volume 1554 of
Lecture Notes in Mathematics, pages 50–94. Springer–Verlag, 1993.
[B¨urgisser et al. 1997] P. B¨urgisser, M. Clausen, and M. Shokrollahi. Algebraic Complexity Theory. Springer–Verlag, 1997.
[Burnikel and Ziegler 1998] C. Burnikel and J. Ziegler. Fast recursive division. Max-Planck-Institut f¨ur Informatik Research Report MPI-I-98-1-022, 1998. http:www.algorilla.de/Download/FastRecursiveDivision.ps.gz.
[Burthe 1996] R. Burthe. Further investigations with the strong probable prime test. Math. Comp., 65:373–381, 1996.
[Burthe 1997] R. Burthe. Upper bounds for least witnesses and generating sets. Acta Arith., 80:311–326, 1997.
[Caldwell 1999] C. Caldwell. Website for prime numbers, 1999. http://primes.utm.edu/.
[Canfield et al. 1983] E. Canfield, P. Erd˝os, and C. Pomerance. On a problem of Oppenheim concerning “factorisatio numerorum”. J. Number Theory, 17:1–28, 1983.
[Cassels 1966] J. Cassels. Diophantine equations with special reference to elliptic curves. J. London Math. Soc., 41:193–291, 1966.
[Cesari 1998] G. Cesari. Parallel implementation of Sch¨onhage’s integer GCD algorithm. In [Buhler 1998], pages 64–76.
[Chen 1966] J. Chen. On the representation of a large even integer as the sum of a prime and the product of at most two primes. Kexue Tongbao, 17:385–386, 1966.
[Cochrane 1987] T. Cochrane. On a trigonometric inequality of Vinogradov. J. Number Theory, 27:9–16, 1987.
[Cohen 2000] H. Cohen. A Course in Computational Algebraic Number Theory, volume 138 of Graduate Texts in Mathematics. Springer–Verlag, 2000.