1 |
//$Header: /cvsroot/esrg/sfesrg/esrgnxpj/sfnthcgi0304/sieve_eratosthenes.h,v 1.4 2003/04/17 20:02:05 dtashley Exp $ |
//$Header$ |
2 |
// |
// |
3 |
//******************************************************************************** |
//******************************************************************************** |
4 |
//Copyright (C) 2003 David T. Ashley |
//Copyright (C) 2003 David T. Ashley |
5 |
//******************************************************************************** |
//******************************************************************************** |
6 |
//This program or source file is free software; you can redistribute it and/or |
//This program or source file is free software; you can redistribute it and/or |
7 |
//modify it under the terms of the GNU General Public License as published by |
//modify it under the terms of the GNU General Public License as published by |
8 |
//the Free Software Foundation; either version 2 of the License, or (at your |
//the Free Software Foundation; either version 2 of the License, or (at your |
9 |
//option) any later version. |
//option) any later version. |
10 |
// |
// |
11 |
//This program or source file is distributed in the hope that it will |
//This program or source file is distributed in the hope that it will |
12 |
//be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
//be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
//GNU General Public License for more details. |
//GNU General Public License for more details. |
15 |
// |
// |
16 |
//You may have received a copy of the GNU General Public License |
//You may have received a copy of the GNU General Public License |
17 |
//along with this program; if not, write to the Free Software |
//along with this program; if not, write to the Free Software |
18 |
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
//******************************************************************************** |
//******************************************************************************** |
20 |
// |
// |
21 |
#ifndef SIEVE_ERATOSTHENES_H_INCLUDED |
#ifndef SIEVE_ERATOSTHENES_H_INCLUDED |
22 |
#define SIEVE_ERATOSTHENES_H_INCLUDED |
#define SIEVE_ERATOSTHENES_H_INCLUDED |
23 |
|
|
24 |
#ifdef MODULE_SIEVE_ERATOSTHENES |
#ifdef MODULE_SIEVE_ERATOSTHENES |
25 |
#define DECMOD_SIEVE_ERATOSTHENES |
#define DECMOD_SIEVE_ERATOSTHENES |
26 |
#else |
#else |
27 |
#define DECMOD_SIEVE_ERATOSTHENES extern |
#define DECMOD_SIEVE_ERATOSTHENES extern |
28 |
#endif |
#endif |
29 |
|
|
30 |
//Declare the factors which must be checked before using the table. |
//Declare the factors which must be checked before using the table. |
31 |
#define SIEVE_ERATOSTHENES_N_SIEVE_FACTORS (5) |
#define SIEVE_ERATOSTHENES_N_SIEVE_FACTORS (5) |
32 |
DECMOD_SIEVE_ERATOSTHENES |
DECMOD_SIEVE_ERATOSTHENES |
33 |
const unsigned SIEVE_ERATOSTHENES_sieve_factors[SIEVE_ERATOSTHENES_N_SIEVE_FACTORS]; |
const unsigned SIEVE_ERATOSTHENES_sieve_factors[SIEVE_ERATOSTHENES_N_SIEVE_FACTORS]; |
34 |
|
|
35 |
//Declare the sieve table itself. |
//Declare the sieve table itself. |
36 |
#define SIEVE_ERATOSTHENES_N_SIEVE (480) |
#define SIEVE_ERATOSTHENES_N_SIEVE (480) |
37 |
DECMOD_SIEVE_ERATOSTHENES |
DECMOD_SIEVE_ERATOSTHENES |
38 |
const unsigned SIEVE_ERATOSTHENES_sieve[SIEVE_ERATOSTHENES_N_SIEVE]; |
const unsigned SIEVE_ERATOSTHENES_sieve[SIEVE_ERATOSTHENES_N_SIEVE]; |
39 |
|
|
40 |
//Declare the first starting prime number to use in the trial divisions, and |
//Declare the first starting prime number to use in the trial divisions, and |
41 |
//after that is exhausted the index of the first table entry to use to advance |
//after that is exhausted the index of the first table entry to use to advance |
42 |
//the trial divisor. |
//the trial divisor. |
43 |
#define SIEVE_ERATOSTHENES_FIRST_TRIAL_DIVISOR (13) |
#define SIEVE_ERATOSTHENES_FIRST_TRIAL_DIVISOR (13) |
44 |
#define SIEVE_ERATOSTHENES_FIRST_SIEVE_INDEX (1) |
#define SIEVE_ERATOSTHENES_FIRST_SIEVE_INDEX (1) |
45 |
|
|
46 |
#endif /* SIEVE_ERATOSTHENES_H_INCLUDED */ |
#endif /* SIEVE_ERATOSTHENES_H_INCLUDED */ |
47 |
|
|
48 |
//******************************************************************************** |
//******************************************************************************** |
49 |
// $Log: sieve_eratosthenes.h,v $ |
// $Log: sieve_eratosthenes.h,v $ |
50 |
// Revision 1.4 2003/04/17 20:02:05 dtashley |
// Revision 1.4 2003/04/17 20:02:05 dtashley |
51 |
// License text for the GPL added. All source files are now under the GPL, |
// License text for the GPL added. All source files are now under the GPL, |
52 |
// after some discussion on the GMP list. |
// after some discussion on the GMP list. |
53 |
// |
// |
54 |
// Revision 1.3 2003/04/16 07:02:06 dtashley |
// Revision 1.3 2003/04/16 07:02:06 dtashley |
55 |
// Spelling of Greek name corrected to Eratosthenes from incorrect Erastothenes. |
// Spelling of Greek name corrected to Eratosthenes from incorrect Erastothenes. |
56 |
// |
// |
57 |
// Revision 1.2 2003/04/15 22:46:18 dtashley |
// Revision 1.2 2003/04/15 22:46:18 dtashley |
58 |
// sieve_erastothenes.c |
// sieve_erastothenes.c |
59 |
// |
// |
60 |
// Revision 1.1 2003/04/15 22:35:41 dtashley |
// Revision 1.1 2003/04/15 22:35:41 dtashley |
61 |
// Initial checkin. |
// Initial checkin. |
62 |
//******************************************************************************** |
//******************************************************************************** |
63 |
// End of SIEVE_ERATOSTHENES.H. |
// End of SIEVE_ERATOSTHENES.H. |
64 |
//******************************************************************************** |
//******************************************************************************** |