Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Concurrent Prime Number Test Model Documents

This material has 4 associated documents. Select a document title to view a document's information.

Main Document

Parallel Region Prime Number Computation Model 

written by Wolfgang Christian

The Concurrent Prime Number Test uses the trial division algorithm to decide if a number is prime.  The prime division algorithm is inefficient and we use it here only to test the EJS implementation of the Parallel Region Element in EJS.  A parallel region executes independent code in threads that execute simultaneously on a multi-core processor. The screen capture shows that the total execution time for four computations on a quad-core processor is only one millisecond longer than the execution time for the longest single computation.  This linear speedup is close to the theoretical maximum.

The Concurrent Prime Number Test Model was created using the Easy Java Simulations (EJS) modeling tool.  It is distributed as a ready-to-run (compiled) Java archive.  Double clicking the model's jar file will run the simulation if Java is installed.

Last Modified June 3, 2014

This file has previous versions.

Supplemental Documents

Sequential Prime Number Test Model 

The Sequential Prime Number Test model uses the prime division algorithm to decide if a number is prime.  The model records the computational time in milliseconds required to test each number and total computational time.  The model shows that the total computational time is approximately equal to the sum of the individual times because the tests are performed sequentially.
 

Last Modified October 11, 2013

Source Code Documents (2)

Concurrent Prime Number Test Source Code 

The source code zip archive contains an XML representation of the Parallel Region Prime Number Computation Model.  Unzip this archive in your Ejs workspace to compile and run this model using EJS.

Last Modified October 15, 2013

This file has previous versions.

Sequential Prime Number Test Source Code 

The source code zip archive contains an XML representation of the Sequential Prime Number Test Model.   Unzip this archive in your EJS workspace to compile and run this model using EJS.

Last Modified October 11, 2013

The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics