Java Glossary : primes

CMP home Java glossary home Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

You are here : home : Java Glossary : P words : primes.

primes
A number divisible only by itself and one. Primes are useful in constructing Hashtables. You can download Java source code to perform an Eratosthenes sieve to compute the primes, whether a number is prime, or the next prime above or below a given number. Mitch Gallant has posted some methods to test if an individual number is prime. Try BigInteger.isProbablePrime for determining if huge numbers are prime.

Mersenne primes are convenient for computing. The have the form 2n-1. The Mersenne primes that fall into the range of longs are:

Mersenne Primes
n 2 3 5 7 13 17 19 31 61
2n-1 (hex) 0x3 0x7 0x1f 0x7f 0x1fff 0x1ffff 0x7ffff 0x7fffffff -0x1fffffffffffffffL
2n-1 (decimal) 3 7 31 127 8,191 131,071 524,287 2,147,483,647 2,305,843,009,213,693,951
The largest Mersenne prime found as of 2002 May 24 was 2213466917-1.

See BigInteger.isProbablyPrime().


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 978.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/primes.html J:\mindprod\jgloss\primes.html