/* * Copyright (c) 1995 by Landon Curt Noll. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby granted, * provided that the above copyright, this permission notice and text * this comment, and the disclaimer below appear in all of the following: * * supporting documentation * source copies * source works derived from this source * binaries derived from this source or from derived source * * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * chongo was here /\../\ */ #include "zmath.h" #include "prime.h" #include "have_const.h" /* * pi10b - number of primes <= 2^18 in multiples of 2^10 * * pi10b[x] == pi(x*1024) for 0 <= x <= 256 */ CONST unsigned short pi10b[(MAX_PI10B/1024)+1+1] = { 0, 172, 309, 439, 564, 685, 801, 916, 1028, 1142, 1254, 1362, 1469, 1580, 1681, 1794, 1900, 2002, 2110, 2205, 2312, 2413, 2517, 2618, 2725, 2818, 2918, 3016, 3124, 3221, 3314, 3414, 3512, 3619, 3716, 3808, 3908, 4006, 4098, 4197, 4288, 4391, 4495, 4583, 4678, 4767, 4858, 4956, 5051, 5152, 5239, 5339, 5432, 5520, 5616, 5711, 5814, 5908, 6003, 6094, 6179, 6270, 6363, 6453, 6542, 6636, 6734, 6820, 6906, 6999, 7095, 7190, 7281, 7371, 7465, 7550, 7649, 7733, 7824, 7915, 8009, 8103, 8187, 8277, 8363, 8453, 8548, 8630, 8727, 8812, 8899, 9000, 9087, 9180, 9271, 9357, 9439, 9533, 9618, 9708, 9805, 9886, 9971, 10062, 10151, 10236, 10324, 10416, 10499, 10585, 10674, 10761, 10846, 10930, 11021, 11110, 11196, 11282, 11371, 11462, 11554, 11641, 11729, 11816, 11900, 11987, 12079, 12163, 12251, 12333, 12425, 12507, 12589, 12680, 12777, 12861, 12941, 13032, 13125, 13212, 13289, 13372, 13452, 13546, 13631, 13712, 13807, 13894, 13982, 14072, 14159, 14242, 14327, 14407, 14497, 14577, 14662, 14750, 14835, 14915, 14999, 15086, 15167, 15247, 15334, 15408, 15495, 15585, 15670, 15758, 15843, 15925, 16003, 16097, 16173, 16264, 16357, 16433, 16519, 16601, 16690, 16775, 16869, 16954, 17032, 17119, 17200, 17282, 17369, 17457, 17536, 17623, 17704, 17789, 17877, 17957, 18038, 18118, 18205, 18285, 18367, 18450, 18535, 18624, 18710, 18798, 18889, 18974, 19045, 19130, 19213, 19290, 19370, 19453, 19541, 19628, 19709, 19797, 19876, 19960, 20043, 20126, 20206, 20288, 20379, 20476, 20552, 20632, 20709, 20787, 20870, 20946, 21022, 21109, 21191, 21272, 21359, 21446, 21527, 21613, 21695, 21776, 21859, 21950, 22031, 22106, 22196, 22276, 22358, 22435, 22525, 22599, 22678, 22765, 22845, 22925, 23000 }; /* * pi18b - primes found in a given 2^18 interval * * i