com.softsynth.jmsl.util
Class Primes

java.lang.Object
  extended by com.softsynth.jmsl.util.Primes

public class Primes
extends java.lang.Object

use sieve of eratosthenes to find prime number nearest to requested value.

Author:
Nick Didkovsky

Constructor Summary
Primes()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static int nearest(int value)
          Calculate prime number nearest to value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Primes

public Primes()
Method Detail

nearest

public static int nearest(int value)
Calculate prime number nearest to value. Will first recalculate entire sieve if value > sieve.length/2

Returns:
prime number nearest to value

main

public static void main(java.lang.String[] args)