Chapter 15. Prime Numbers

   

 
Java Number Cruncher: The Java Programmer's Guide to Numerical Computing
By Ronald  Mak

Table of Contents
Part  IV.   The Joys of Computation


Chapter 15. Prime Numbers

Prime numbers have fascinated professional and amateur mathematicians alike since ancient times. It's a simple concept?aa prime number is any integer greater than 1 that is divisible only by 1 and itself. An integer greater than 1 that is not prime is composite. In this chapter, we'll use Java to explore two topics related to prime numbers.

The first topic is primality testing. Given a positive integer, how can we tell whether it is prime or composite? Of course, we can systematically try dividing the number by a succession of "trial divisors"?aif we find a divisor other than 1 and the number itself that divides evenly into the number (the division leaves no remainder), then the number is composite. If we fail to find such a divisor, then the number must be prime. This algorithm takes far too long, however, if the number we're testing for primality is very large. Are there other ways of testing?

The second topic of this chapter is prime number generation. Are there formulas or algorithms that generate prime numbers? A related question is whether or not there are patterns in the distribution of prime numbers.

There are some interesting parallels with Chapter 14, where we explored random number generation. In this chapter, we'll even encounter numbers that are pseudoprimes.

Before we get to our two main topics, we need to visit a few key ideas from the branch of mathematics called number theory, which is concerned with the properties of numbers, especially the integers.


   
Top
 


Java Number Cruncher. The Java Programmer's Guide to Numerical Computing
Java Number Cruncher: The Java Programmers Guide to Numerical Computing
ISBN: 0130460419
EAN: 2147483647
Year: 2001
Pages: 141
Authors: Ronald Mak

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net