Package demos.goldbach.scripts

Package demos.goldbach.scripts Description

Primes and the Goldbach Conjecture presents a solution to the problem of creating prime numbers and then using those primes to validate the Goldbach conjecture.

Initially evaluate the primes up to N
Then evaluate the Goldbach Conjecture using the primes previously calculated
Goldbach's conjecture is one of the oldest and best-known unsolved problems in number theory and in all of mathematics. It states: Every even integer greater than 2 can be expressed as the sum of two primes.

Let N be the integer up to which we test
We require the primes up to maxP = sqroot(N)+1
Use a sieve to find primes up to maxP
Partition the range up to N to find all the primes in that range, in parallel
Create a single list of primes which is broadcast in parallel to Goldbach workers
Each worker is allocated an (overlapping) range of primes
Each worker then finds all the sequential even numbers it can calculate from its range of primes
Collect the results from each worker and ensure that ranges overlap, except for the last
The maximum Goldbach number will be less than 2*N
Two versions of the source of each example are provided. The version ending 'Chans' has the network defined using user defined channel definitions and each process declares its input and output channels. The version ending '_gpp' does not define the channels nor the channel declarations in the process definitions. The processes have to be defined in the order in which they occur in the dataflow through the application solution. The processes are preceded by the annotation //NETWORK and terminated by //END NETWORK. The program jcsp.gpp.build.GPPbuild can then be used to create the channel definitions, channel declarations and the required parallel constructor required to invoke the process network.

 Author, Licence and Copyright statement
 author  Jon Kerridge
 		   School of Computing
 		   Edinburgh Napier University
 		   Merchiston Campus,
 		   Colinton Road
 		   Edinburgh EH10 5DT

 Author contact: j.kerridge (at) napier.ac.uk

 Copyright  Jon Kerridge Edinburgh Napier University *

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.