de.luschny.math.primes.test
Class SieveTest

java.lang.Object
de.luschny.math.primes.test.SieveTest

public final class SieveTest
extends java.lang.Object

A test and demo suite for de.luschny.math.primes.

 Example demo:
 SieveRange is [1, 10.000.000]
 NumberOfPrimes is 664579.
 Computation in less than 0.5 sec.


Constructor Summary
SieveTest()
          
 
Method Summary
 void benchmarkTenMillionsDemo()
          Lets make a small benchmark.
 void concatenationDemo()
          The concatenation property.
 void concurrentExecutionDemo()
          Demonstrates that iterating the prime sieve is thread save.
 void isPrimeDemo()
          Individual prime/composite number demo.
 void iteratingSubrangeDemo()
          Working with a subrange of the sieve.
static void main(java.lang.String[] willBeIgnored)
          Main - PrimeSieve demo
 void nthPrimeDemo()
          Which is the n-th prime?
 void sanityCheck()
          Test some special cases.
 void saveToFileDemo()
          Save a range of primes to a file.
 void scanDemo()
          Scan the full sieve and count primes.
 void sumOfPrimesDemo()
          Which is the sum of the first n primes?
 void toArrayDemo()
          Extract the primes from the sieve as an array.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SieveTest

public SieveTest()
Method Detail

main

public static void main(java.lang.String[] willBeIgnored)
Main - PrimeSieve demo

Parameters:
willBeIgnored - Parameters, if any, will be ignored.

scanDemo

public void scanDemo()
Scan the full sieve and count primes.


iteratingSubrangeDemo

public void iteratingSubrangeDemo()
Working with a subrange of the sieve.


benchmarkTenMillionsDemo

public void benchmarkTenMillionsDemo()
A small benchmark.


nthPrimeDemo

public void nthPrimeDemo()
Which is the n-th prime?


sumOfPrimesDemo

public void sumOfPrimesDemo()
Which is the sum of the first n primes?


isPrimeDemo

public void isPrimeDemo()
Individual prime/composite number demo.


concatenationDemo

public void concatenationDemo()
The concatenation property.


toArrayDemo

public void toArrayDemo()
Extract the primes from the sieve as an array.


saveToFileDemo

public void saveToFileDemo()
Save a range of primes to a file.


sanityCheck

public void sanityCheck()
Test some special cases.


concurrentExecutionDemo

public void concurrentExecutionDemo()
Demonstrates that iterating the prime sieve is thread save.



Submit a bug or feature
Copyright 2000-2005. All Rights Reserved.
JavaJungle Inc. 3 Rue du Dome, Strasbourg, 67000, France.